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

Side by Side Diff: ui/gfx/canvas_skia.cc

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 357
358 void CanvasSkia::EndPlatformPaint() { 358 void CanvasSkia::EndPlatformPaint() {
359 skia::EndPlatformPaint(canvas_); 359 skia::EndPlatformPaint(canvas_);
360 } 360 }
361 361
362 void CanvasSkia::Transform(const ui::Transform& transform) { 362 void CanvasSkia::Transform(const ui::Transform& transform) {
363 canvas_->concat(transform.matrix()); 363 canvas_->concat(transform.matrix());
364 } 364 }
365 365
366 CanvasSkia* CanvasSkia::AsCanvasSkia() {
367 return this;
368 }
369
370 const CanvasSkia* CanvasSkia::AsCanvasSkia() const {
371 return this;
372 }
373
374 SkCanvas* CanvasSkia::GetSkCanvas() { 366 SkCanvas* CanvasSkia::GetSkCanvas() {
375 return canvas_; 367 return canvas_;
376 } 368 }
377 369
378 const SkCanvas* CanvasSkia::GetSkCanvas() const { 370 const SkCanvas* CanvasSkia::GetSkCanvas() const {
379 return canvas_; 371 return canvas_;
380 } 372 }
381 373
382 //////////////////////////////////////////////////////////////////////////////// 374 ////////////////////////////////////////////////////////////////////////////////
383 // CanvasSkia, private: 375 // CanvasSkia, private:
384 376
385 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) { 377 bool CanvasSkia::IntersectsClipRectInt(int x, int y, int w, int h) {
386 SkRect clip; 378 SkRect clip;
387 return canvas_->getClipBounds(&clip) && 379 return canvas_->getClipBounds(&clip) &&
388 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w), 380 clip.intersect(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + w),
389 SkIntToScalar(y + h)); 381 SkIntToScalar(y + h));
390 } 382 }
391 383
392 ////////////////////////////////////////////////////////////////////////////////
393 // Canvas, public:
394
395 Canvas* Canvas::CreateCanvas() {
396 return new CanvasSkia;
397 }
398
399 Canvas* Canvas::CreateCanvas(const gfx::Size& size, bool is_opaque) {
400 return new CanvasSkia(size, is_opaque);
401 }
402
403 } // namespace gfx 384 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698