| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/StaticBitmapImage.h" | 6 #include "platform/graphics/StaticBitmapImage.h" |
| 7 | 7 |
| 8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/ImageObserver.h" | 9 #include "platform/graphics/ImageObserver.h" |
| 10 #include "platform/graphics/skia/NativeImageSkia.h" | 10 #include "platform/graphics/skia/NativeImageSkia.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 FloatRect normSrcRect = adjustForNegativeSize(srcRect); | 42 FloatRect normSrcRect = adjustForNegativeSize(srcRect); |
| 43 | 43 |
| 44 normSrcRect.intersect(FloatRect(0, 0, m_image->width(), m_image->height())); | 44 normSrcRect.intersect(FloatRect(0, 0, m_image->width(), m_image->height())); |
| 45 | 45 |
| 46 if (normSrcRect.isEmpty() || normDstRect.isEmpty()) | 46 if (normSrcRect.isEmpty() || normDstRect.isEmpty()) |
| 47 return; // Nothing to draw. | 47 return; // Nothing to draw. |
| 48 | 48 |
| 49 ASSERT(normSrcRect.width() <= m_image->width() && normSrcRect.height() <= m_
image->height()); | 49 ASSERT(normSrcRect.width() <= m_image->width() && normSrcRect.height() <= m_
image->height()); |
| 50 | 50 |
| 51 SkPaint paint; | 51 SkPaint paint; |
| 52 ctx->preparePaintForDrawRectToRect(&paint, srcRect, dstRect, compositeOp, bl
endMode); | 52 ctx->preparePaintForDrawRectToRect(&paint, srcRect, dstRect, compositeOp, bl
endMode, currentFrameKnownToBeOpaque()); |
| 53 | 53 |
| 54 SkRect srcSkRect = WebCoreFloatRectToSKRect(normSrcRect); | 54 SkRect srcSkRect = WebCoreFloatRectToSKRect(normSrcRect); |
| 55 SkRect dstSkRect = WebCoreFloatRectToSKRect(normDstRect); | 55 SkRect dstSkRect = WebCoreFloatRectToSKRect(normDstRect); |
| 56 | 56 |
| 57 SkCanvas* canvas = ctx->canvas(); | 57 SkCanvas* canvas = ctx->canvas(); |
| 58 | 58 |
| 59 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint); | 59 canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint); |
| 60 | 60 |
| 61 if (ImageObserver* observer = imageObserver()) | 61 if (ImageObserver* observer = imageObserver()) |
| 62 observer->didDraw(this); | 62 observer->didDraw(this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } | 65 } |
| OLD | NEW |