| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/canvas.h" | 5 #include "ui/gfx/canvas.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 void Canvas::SaveLayerAlpha(uint8_t alpha) { | 192 void Canvas::SaveLayerAlpha(uint8_t alpha) { |
| 193 canvas_->saveLayerAlpha(NULL, alpha); | 193 canvas_->saveLayerAlpha(NULL, alpha); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void Canvas::SaveLayerAlpha(uint8_t alpha, const Rect& layer_bounds) { | 196 void Canvas::SaveLayerAlpha(uint8_t alpha, const Rect& layer_bounds) { |
| 197 SkRect bounds(RectToSkRect(layer_bounds)); | 197 SkRect bounds(RectToSkRect(layer_bounds)); |
| 198 canvas_->saveLayerAlpha(&bounds, alpha); | 198 canvas_->saveLayerAlpha(&bounds, alpha); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void Canvas::SaveLayerWithFlags(const cc::PaintFlags& flags) { |
| 202 canvas_->saveLayer(nullptr /* bounds */, &flags); |
| 203 } |
| 204 |
| 201 void Canvas::Restore() { | 205 void Canvas::Restore() { |
| 202 canvas_->restore(); | 206 canvas_->restore(); |
| 203 } | 207 } |
| 204 | 208 |
| 205 void Canvas::ClipRect(const Rect& rect, SkClipOp op) { | 209 void Canvas::ClipRect(const Rect& rect, SkClipOp op) { |
| 206 canvas_->clipRect(RectToSkRect(rect), op); | 210 canvas_->clipRect(RectToSkRect(rect), op); |
| 207 } | 211 } |
| 208 | 212 |
| 209 void Canvas::ClipRect(const RectF& rect, SkClipOp op) { | 213 void Canvas::ClipRect(const RectF& rect, SkClipOp op) { |
| 210 canvas_->clipRect(RectFToSkRect(rect), op); | 214 canvas_->clipRect(RectFToSkRect(rect), op); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); | 617 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
| 614 flags.setShader(CreateImageRepShaderForScale( | 618 flags.setShader(CreateImageRepShaderForScale( |
| 615 image_rep, SkShader::kRepeat_TileMode, shader_scale, | 619 image_rep, SkShader::kRepeat_TileMode, shader_scale, |
| 616 remove_image_scale ? image_rep.scale() : 1.f)); | 620 remove_image_scale ? image_rep.scale() : 1.f)); |
| 617 | 621 |
| 618 // The rect will be filled by the bitmap. | 622 // The rect will be filled by the bitmap. |
| 619 canvas_->drawRect(dest_rect, flags); | 623 canvas_->drawRect(dest_rect, flags); |
| 620 } | 624 } |
| 621 | 625 |
| 622 } // namespace gfx | 626 } // namespace gfx |
| OLD | NEW |