diff options
author | John Reck <jreck@google.com> | 2012-05-29 21:01:30 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-29 21:01:30 -0700 |
commit | cbfe85d221255eaee1424b1a2f79be6166523bc4 (patch) | |
tree | 6304fb3457ed72ee03193bc3c142833c73579855 /Source | |
parent | cff29754c2515b04a1241a8acb205db466d6a4e3 (diff) | |
parent | 1d51221cb2f00354a8d78776caaaa04347e9b61b (diff) | |
download | external_webkit-cbfe85d221255eaee1424b1a2f79be6166523bc4.zip external_webkit-cbfe85d221255eaee1424b1a2f79be6166523bc4.tar.gz external_webkit-cbfe85d221255eaee1424b1a2f79be6166523bc4.tar.bz2 |
am 1d51221c: am 4a0b0816: Merge "Don\'t use setupPaintFill for drawBitmap" into jb-dev
* commit '1d51221cb2f00354a8d78776caaaa04347e9b61b':
Don't use setupPaintFill for drawBitmap
Diffstat (limited to 'Source')
3 files changed, 15 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp index 944dc98..3b37693 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.cpp @@ -231,6 +231,16 @@ void PlatformGraphicsContext::setAlpha(float alpha) m_state->alpha = alpha; } +int PlatformGraphicsContext::getNormalizedAlpha() const +{ + int alpha = roundf(m_state->alpha * 256); + if (alpha > 255) + alpha = 255; + else if (alpha < 0) + alpha = 0; + return alpha; +} + void PlatformGraphicsContext::setCompositeOperation(CompositeOperator op) { m_state->mode = WebCoreCompositeToSkiaComposite(op); diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h index 601de0f..1916014 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h @@ -59,6 +59,7 @@ public: // State values virtual void setAlpha(float alpha); + int getNormalizedAlpha() const; virtual void setCompositeOperation(CompositeOperator op); virtual void setFillColor(const Color& c); virtual void setFillShader(SkShader* fillShader); diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp index 9b32726..f00bb02 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.cpp @@ -234,7 +234,8 @@ void PlatformGraphicsContextSkia::drawBitmapPattern( SkShader::kRepeat_TileMode); shader->setLocalMatrix(matrix); SkPaint paint; - setupPaintFill(&paint); + setupPaintCommon(&paint); + paint.setAlpha(getNormalizedAlpha()); paint.setShader(shader); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(compositeOp)); fixPaintForBitmapsThatMaySeam(&paint); @@ -246,7 +247,8 @@ void PlatformGraphicsContextSkia::drawBitmapRect(const SkBitmap& bitmap, CompositeOperator op) { SkPaint paint; - setupPaintFill(&paint); + setupPaintCommon(&paint); + paint.setAlpha(getNormalizedAlpha()); paint.setXfermodeMode(WebCoreCompositeToSkiaComposite(op)); fixPaintForBitmapsThatMaySeam(&paint); |