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_skia.h" | 5 #include "ui/gfx/canvas_skia.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 namespace gfx { | 48 namespace gfx { |
49 | 49 |
50 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
51 // CanvasSkia, public: | 51 // CanvasSkia, public: |
52 | 52 |
53 CanvasSkia::CanvasSkia(const gfx::Size& size, bool is_opaque) | 53 CanvasSkia::CanvasSkia(const gfx::Size& size, bool is_opaque) |
54 : owned_canvas_(new skia::PlatformCanvas(size.width(), size.height(), | 54 : owned_canvas_(new skia::PlatformCanvas(size.width(), size.height(), |
55 is_opaque)), | 55 is_opaque)), |
56 canvas_(owned_canvas_.get()) { | 56 canvas_(owned_canvas_.get()) { |
57 #if defined(OS_WIN) || defined(OS_MACOSX) | |
58 // skia::PlatformCanvas instances are initialized to 0 by Cairo on Linux, but | |
msw
2012/03/15 21:53:07
Should this be done in Skia / SkCanvas?
Jeff Timanus
2012/03/15 22:26:53
SkCanvas used to construct initialized 0, but that
| |
59 // uninitialized on Win and Mac. | |
60 owned_canvas_->clear(SkColorSetARGB(0, 0, 0, 0)); | |
msw
2012/03/15 21:53:07
Can this be skipped for is_opaque == true or false
Jeff Timanus
2012/03/15 22:26:53
You're right, but the old behaviour was a little c
| |
61 #endif | |
57 } | 62 } |
58 | 63 |
59 CanvasSkia::CanvasSkia(const SkBitmap& bitmap, bool is_opaque) | 64 CanvasSkia::CanvasSkia(const SkBitmap& bitmap, bool is_opaque) |
60 : owned_canvas_(new skia::PlatformCanvas(bitmap.width(), bitmap.height(), | 65 : owned_canvas_(new skia::PlatformCanvas(bitmap.width(), bitmap.height(), |
61 is_opaque)), | 66 is_opaque)), |
62 canvas_(owned_canvas_.get()) { | 67 canvas_(owned_canvas_.get()) { |
63 DrawBitmapInt(bitmap, 0, 0); | 68 DrawBitmapInt(bitmap, 0, 0); |
64 } | 69 } |
65 | 70 |
66 CanvasSkia::CanvasSkia() | 71 CanvasSkia::CanvasSkia() |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 // CanvasSkia, private: | 379 // CanvasSkia, private: |
375 | 380 |
376 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) { | 381 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) { |
377 SkRect clip; | 382 SkRect clip; |
378 return canvas_->getClipBounds(&clip) && | 383 return canvas_->getClipBounds(&clip) && |
379 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), | 384 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), |
380 SkIntToScalar(y + h)); | 385 SkIntToScalar(y + h)); |
381 } | 386 } |
382 | 387 |
383 } // namespace gfx | 388 } // namespace gfx |
OLD | NEW |