| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 void Canvas::Save() { | 179 void Canvas::Save() { |
| 180 canvas_->save(); | 180 canvas_->save(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void Canvas::SaveLayerAlpha(uint8 alpha) { | 183 void Canvas::SaveLayerAlpha(uint8 alpha) { |
| 184 canvas_->saveLayerAlpha(NULL, alpha); | 184 canvas_->saveLayerAlpha(NULL, alpha); |
| 185 } | 185 } |
| 186 | 186 |
| 187 | |
| 188 void Canvas::SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds) { | 187 void Canvas::SaveLayerAlpha(uint8 alpha, const Rect& layer_bounds) { |
| 189 SkRect bounds(RectToSkRect(layer_bounds)); | 188 SkRect bounds(RectToSkRect(layer_bounds)); |
| 190 canvas_->saveLayerAlpha(&bounds, alpha); | 189 canvas_->saveLayerAlpha(&bounds, alpha); |
| 191 } | 190 } |
| 192 | 191 |
| 193 void Canvas::Restore() { | 192 void Canvas::Restore() { |
| 194 canvas_->restore(); | 193 canvas_->restore(); |
| 195 } | 194 } |
| 196 | 195 |
| 197 void Canvas::ClipRect(const Rect& rect) { | 196 void Canvas::ClipRect(const Rect& rect) { |
| 198 canvas_->clipRect(RectToSkRect(rect)); | 197 canvas_->clipRect(RectToSkRect(rect)); |
| 199 } | 198 } |
| 200 | 199 |
| 201 void Canvas::ClipPath(const SkPath& path) { | 200 void Canvas::ClipPath(const SkPath& path, bool do_anti_alias) { |
| 202 canvas_->clipPath(path); | 201 canvas_->clipPath(path, SkRegion::kIntersect_Op, do_anti_alias); |
| 203 } | 202 } |
| 204 | 203 |
| 205 bool Canvas::IsClipEmpty() const { | 204 bool Canvas::IsClipEmpty() const { |
| 206 return canvas_->isClipEmpty(); | 205 return canvas_->isClipEmpty(); |
| 207 } | 206 } |
| 208 | 207 |
| 209 bool Canvas::GetClipBounds(Rect* bounds) { | 208 bool Canvas::GetClipBounds(Rect* bounds) { |
| 210 SkRect out; | 209 SkRect out; |
| 211 bool has_non_empty_clip = canvas_->getClipBounds(&out); | 210 bool has_non_empty_clip = canvas_->getClipBounds(&out); |
| 212 bounds->SetRect(out.left(), out.top(), out.width(), out.height()); | 211 bounds->SetRect(out.left(), out.top(), out.width(), out.height()); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 SkPaint p(paint); | 627 SkPaint p(paint); |
| 629 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel | 628 p.setFilterLevel(filter ? SkPaint::kLow_FilterLevel |
| 630 : SkPaint::kNone_FilterLevel); | 629 : SkPaint::kNone_FilterLevel); |
| 631 p.setShader(shader.get()); | 630 p.setShader(shader.get()); |
| 632 | 631 |
| 633 // The rect will be filled by the bitmap. | 632 // The rect will be filled by the bitmap. |
| 634 canvas_->drawRect(dest_rect, p); | 633 canvas_->drawRect(dest_rect, p); |
| 635 } | 634 } |
| 636 | 635 |
| 637 } // namespace gfx | 636 } // namespace gfx |
| OLD | NEW |