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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month 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
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkBitmapDevice.h" 11 #include "SkBitmapDevice.h"
12 #include "SkBounder.h" 12 #include "SkBounder.h"
13 #include "SkDeviceImageFilterProxy.h" 13 #include "SkDeviceImageFilterProxy.h"
14 #include "SkDraw.h" 14 #include "SkDraw.h"
15 #include "SkDrawFilter.h" 15 #include "SkDrawFilter.h"
16 #include "SkDrawLooper.h" 16 #include "SkDrawLooper.h"
17 #include "SkMetaData.h" 17 #include "SkMetaData.h"
18 #include "SkPathOps.h" 18 #include "SkPathOps.h"
19 #include "SkPicture.h" 19 #include "SkPicture.h"
20 #include "SkRasterClip.h" 20 #include "SkRasterClip.h"
21 #include "SkRRect.h" 21 #include "SkRRect.h"
22 #include "SkScalarCompare.h" 22 #include "SkScalarCompare.h"
23 #include "SkSurface_Base.h" 23 #include "SkSurface_Base.h"
24 #include "SkTemplates.h" 24 #include "SkTemplates.h"
25 #include "SkTextFormatParams.h" 25 #include "SkTextFormatParams.h"
26 #include "SkTLazy.h" 26 #include "SkTLazy.h"
27 #include "SkUtils.h" 27 #include "SkUtils.h"
28 28
29 #if SK_SUPPORT_GPU
30 #include "GrRenderTarget.h"
31 #endif
32
29 SK_DEFINE_INST_COUNT(SkBounder) 33 SK_DEFINE_INST_COUNT(SkBounder)
30 SK_DEFINE_INST_COUNT(SkCanvas) 34 SK_DEFINE_INST_COUNT(SkCanvas)
31 SK_DEFINE_INST_COUNT(SkDrawFilter) 35 SK_DEFINE_INST_COUNT(SkDrawFilter)
32 36
33 // experimental for faster tiled drawing... 37 // experimental for faster tiled drawing...
34 //#define SK_ENABLE_CLIP_QUICKREJECT 38 //#define SK_ENABLE_CLIP_QUICKREJECT
35 39
36 //#define SK_TRACE_SAVERESTORE 40 //#define SK_TRACE_SAVERESTORE
37 41
38 #ifdef SK_TRACE_SAVERESTORE 42 #ifdef SK_TRACE_SAVERESTORE
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 int width, int height, 1567 int width, int height,
1564 bool isOpaque) { 1568 bool isOpaque) {
1565 SkBaseDevice* device = this->getDevice(); 1569 SkBaseDevice* device = this->getDevice();
1566 if (device) { 1570 if (device) {
1567 return device->createCompatibleDevice(config, width, height, isOpaque); 1571 return device->createCompatibleDevice(config, width, height, isOpaque);
1568 } else { 1572 } else {
1569 return NULL; 1573 return NULL;
1570 } 1574 }
1571 } 1575 }
1572 1576
1577 GrContext* SkCanvas::getGrContext() {
1578 #if SK_SUPPORT_GPU
1579 SkBaseDevice* device = this->getTopDevice();
1580 if (NULL != device) {
1581 GrRenderTarget* renderTarget = device->accessRenderTarget();
1582 if (NULL != renderTarget) {
1583 return renderTarget->getContext();
1584 }
1585 }
1586 #endif
1587
1588 return NULL;
1589
1590 }
1573 1591
1574 ////////////////////////////////////////////////////////////////////////////// 1592 //////////////////////////////////////////////////////////////////////////////
1575 // These are the virtual drawing methods 1593 // These are the virtual drawing methods
1576 ////////////////////////////////////////////////////////////////////////////// 1594 //////////////////////////////////////////////////////////////////////////////
1577 1595
1578 void SkCanvas::clear(SkColor color) { 1596 void SkCanvas::clear(SkColor color) {
1579 SkDrawIter iter(this); 1597 SkDrawIter iter(this);
1580 this->predrawNotify(); 1598 this->predrawNotify();
1581 while (iter.next()) { 1599 while (iter.next()) {
1582 iter.fDevice->clear(color); 1600 iter.fDevice->clear(color);
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 return *paint; 2224 return *paint;
2207 } 2225 }
2208 2226
2209 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2227 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2210 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2228 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2211 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2229 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2212 2230
2213 /////////////////////////////////////////////////////////////////////////////// 2231 ///////////////////////////////////////////////////////////////////////////////
2214 2232
2215 SkCanvas::ClipVisitor::~ClipVisitor() { } 2233 SkCanvas::ClipVisitor::~ClipVisitor() { }
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698