Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp

Issue 2743363006: Clean up cc/paint interfaces (Closed)
Patch Set: Fix PaintControllerTest v2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "platform/graphics/PaintGeneratedImage.h" 5 #include "platform/graphics/PaintGeneratedImage.h"
6 6
7 #include "platform/geometry/FloatRect.h" 7 #include "platform/geometry/FloatRect.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/PaintRecord.h" 9 #include "platform/graphics/paint/PaintRecord.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 void PaintGeneratedImage::draw(PaintCanvas* canvas, 13 void PaintGeneratedImage::draw(PaintCanvas* canvas,
14 const PaintFlags& flags, 14 const PaintFlags& flags,
15 const FloatRect& destRect, 15 const FloatRect& destRect,
16 const FloatRect& srcRect, 16 const FloatRect& srcRect,
17 RespectImageOrientationEnum, 17 RespectImageOrientationEnum,
18 ImageClampingMode) { 18 ImageClampingMode) {
19 PaintCanvasAutoRestore ar(canvas, true); 19 PaintCanvasAutoRestore ar(canvas, true);
20 canvas->clipRect(destRect); 20 canvas->clipRect(destRect);
21 canvas->translate(destRect.x(), destRect.y()); 21 canvas->translate(destRect.x(), destRect.y());
22 if (destRect.size() != srcRect.size()) 22 if (destRect.size() != srcRect.size())
23 canvas->scale(destRect.width() / srcRect.width(), 23 canvas->scale(destRect.width() / srcRect.width(),
24 destRect.height() / srcRect.height()); 24 destRect.height() / srcRect.height());
25 canvas->translate(-srcRect.x(), -srcRect.y()); 25 canvas->translate(-srcRect.x(), -srcRect.y());
26 canvas->drawPicture(m_record.get(), nullptr, &flags); 26 canvas->drawPicture(m_record, nullptr, &flags);
27 } 27 }
28 28
29 void PaintGeneratedImage::drawTile(GraphicsContext& context, 29 void PaintGeneratedImage::drawTile(GraphicsContext& context,
30 const FloatRect& srcRect) { 30 const FloatRect& srcRect) {
31 context.drawRecord(m_record.get()); 31 context.drawRecord(m_record);
32 } 32 }
33 33
34 } // namespace blink 34 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698