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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintRenderingContext2D.cpp

Issue 2104103003: Fix zoom in CSS paint worklets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2nd rebase Created 4 years, 5 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 "modules/csspaint/PaintRenderingContext2D.h" 5 #include "modules/csspaint/PaintRenderingContext2D.h"
6 6
7 #include "platform/graphics/ImageBuffer.h" 7 #include "platform/graphics/ImageBuffer.h"
8 #include <memory> 8 #include <memory>
9 9
10 namespace blink { 10 namespace blink {
11 11
12 PaintRenderingContext2D::PaintRenderingContext2D(std::unique_ptr<ImageBuffer> im ageBuffer, bool hasAlpha) 12 PaintRenderingContext2D::PaintRenderingContext2D(std::unique_ptr<ImageBuffer> im ageBuffer, bool hasAlpha, float zoom)
13 : m_imageBuffer(std::move(imageBuffer)), m_hasAlpha(hasAlpha) 13 : m_imageBuffer(std::move(imageBuffer)), m_hasAlpha(hasAlpha)
14 { 14 {
15 m_clipAntialiasing = AntiAliased; 15 m_clipAntialiasing = AntiAliased;
16 modifiableState().setShouldAntialias(true); 16 modifiableState().setShouldAntialias(true);
17 17
18
19 // RecordingImageBufferSurface doesn't call ImageBufferSurface::clear explic itly. 18 // RecordingImageBufferSurface doesn't call ImageBufferSurface::clear explic itly.
20 DCHECK(m_imageBuffer); 19 DCHECK(m_imageBuffer);
21 m_imageBuffer->canvas()->clear(hasAlpha ? SK_ColorTRANSPARENT : SK_ColorBLAC K); 20 m_imageBuffer->canvas()->clear(hasAlpha ? SK_ColorTRANSPARENT : SK_ColorBLAC K);
22 m_imageBuffer->didDraw(FloatRect(0, 0, width(), height())); 21 m_imageBuffer->didDraw(FloatRect(0, 0, width(), height()));
22
23 m_imageBuffer->canvas()->scale(zoom, zoom);
23 } 24 }
24 25
25 int PaintRenderingContext2D::width() const 26 int PaintRenderingContext2D::width() const
26 { 27 {
27 ASSERT(m_imageBuffer); 28 ASSERT(m_imageBuffer);
28 return m_imageBuffer->size().width(); 29 return m_imageBuffer->size().width();
29 } 30 }
30 31
31 int PaintRenderingContext2D::height() const 32 int PaintRenderingContext2D::height() const
32 { 33 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 { 71 {
71 #if ENABLE(ASSERT) 72 #if ENABLE(ASSERT)
72 SkCanvas* skCanvas = existingDrawingCanvas(); 73 SkCanvas* skCanvas = existingDrawingCanvas();
73 if (skCanvas) { 74 if (skCanvas) {
74 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz e()); 75 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz e());
75 } 76 }
76 #endif 77 #endif
77 } 78 }
78 79
79 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698