OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "platform/graphics/PaintGeneratedImage.h" |
| 6 |
| 7 #include "platform/geometry/FloatRect.h" |
| 8 #include "platform/graphics/GraphicsContext.h" |
| 9 #include "third_party/skia/include/core/SkPicture.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 void PaintGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const Flo
atRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageCl
ampingMode) |
| 14 { |
| 15 SkAutoCanvasRestore ar(canvas, true); |
| 16 canvas->clipRect(destRect); |
| 17 canvas->translate(destRect.x(), destRect.y()); |
| 18 if (destRect.size() != srcRect.size()) |
| 19 canvas->scale(destRect.width() / srcRect.width(), destRect.height() / sr
cRect.height()); |
| 20 canvas->translate(-srcRect.x(), -srcRect.y()); |
| 21 canvas->drawPicture(m_picture.get(), nullptr, &paint); |
| 22 } |
| 23 |
| 24 void PaintGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& sr
cRect) |
| 25 { |
| 26 context.drawPicture(m_picture.get()); |
| 27 } |
| 28 |
| 29 } // namespace blink |
OLD | NEW |