diff options
author | Chris Craik <ccraik@google.com> | 2012-09-28 15:11:12 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2012-10-01 11:03:13 -0700 |
commit | 42326004062d6b846c3050ad03a1e80fa9db425c (patch) | |
tree | 5be919630a5838cdef4adcc03975edda49fa1832 /Source/WebCore/platform/graphics/android/context | |
parent | 224e946b3cabeaa9c360bdd6865485b5acb34cdc (diff) | |
download | external_webkit-42326004062d6b846c3050ad03a1e80fa9db425c.zip external_webkit-42326004062d6b846c3050ad03a1e80fa9db425c.tar.gz external_webkit-42326004062d6b846c3050ad03a1e80fa9db425c.tar.bz2 |
Determine maxZoomScale from bitmap/text drawing
bug:7247750
Change-Id: I8238acc2c20942ab2f42936d16a03226909aebcd
Diffstat (limited to 'Source/WebCore/platform/graphics/android/context')
-rw-r--r-- | Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp index 867ff56..c865a54 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp @@ -498,7 +498,7 @@ PlatformGraphicsContextRecording::PlatformGraphicsContextRecording(Recording* re , mPicture(0) , mRecording(recording) , mOperationState(0) - , m_hasText(false) + , m_maxZoomScale(1) , m_isEmpty(true) , m_canvasProxy(this) { @@ -524,7 +524,7 @@ bool PlatformGraphicsContextRecording::isPaintingDisabled() SkCanvas* PlatformGraphicsContextRecording::recordingCanvas() { - m_hasText = true; + m_maxZoomScale = 1e6f; return &m_canvasProxy; } @@ -779,6 +779,9 @@ void PlatformGraphicsContextRecording::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, const SkRect& dst, CompositeOperator op) { + float widthScale = dst.width() == 0 ? 1 : bitmap.width() / dst.width(); + float heightScale = dst.height() == 0 ? 1 : bitmap.height() / dst.height(); + m_maxZoomScale = std::max(m_maxZoomScale, std::max(widthScale, heightScale)); appendDrawingOperation(NEW_OP(DrawBitmapRect)(bitmap, *src, dst, op), dst); } diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h index 061ee0e..930f1f2 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h @@ -143,7 +143,7 @@ public: bool translucent = false, bool drawBackground = true, const IntRect& thumb = IntRect()); - bool hasText() { return m_hasText; } + float maxZoomScale() { return m_maxZoomScale; } bool isEmpty() { return m_isEmpty; } private: @@ -206,7 +206,7 @@ private: Vector<SkMatrix> mMatrixStack; State* mOperationState; - bool m_hasText; + float m_maxZoomScale; bool m_isEmpty; RecordingContextCanvasProxy m_canvasProxy; }; |