| OLD | NEW |
| 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) | 12 PaintRenderingContext2D::PaintRenderingContext2D(std::unique_ptr<ImageBuffer> im
ageBuffer, float zoom) |
| 13 : m_imageBuffer(std::move(imageBuffer)) | 13 : m_imageBuffer(std::move(imageBuffer)) |
| 14 { | 14 { |
| 15 m_clipAntialiasing = AntiAliased; | 15 m_clipAntialiasing = AntiAliased; |
| 16 modifiableState().setShouldAntialias(true); | 16 modifiableState().setShouldAntialias(true); |
| 17 m_imageBuffer->canvas()->scale(zoom, zoom); |
| 17 } | 18 } |
| 18 | 19 |
| 19 int PaintRenderingContext2D::width() const | 20 int PaintRenderingContext2D::width() const |
| 20 { | 21 { |
| 21 ASSERT(m_imageBuffer); | 22 ASSERT(m_imageBuffer); |
| 22 return m_imageBuffer->size().width(); | 23 return m_imageBuffer->size().width(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 int PaintRenderingContext2D::height() const | 26 int PaintRenderingContext2D::height() const |
| 26 { | 27 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 { | 65 { |
| 65 #if ENABLE(ASSERT) | 66 #if ENABLE(ASSERT) |
| 66 SkCanvas* skCanvas = existingDrawingCanvas(); | 67 SkCanvas* skCanvas = existingDrawingCanvas(); |
| 67 if (skCanvas) { | 68 if (skCanvas) { |
| 68 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz
e()); | 69 ASSERT(static_cast<size_t>(skCanvas->getSaveCount()) == m_stateStack.siz
e()); |
| 69 } | 70 } |
| 70 #endif | 71 #endif |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |