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

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

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed implicit casting in patch.cpp Created 6 years, 4 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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPatch.cpp » ('j') | 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDevice.h" 8 #include "SkDevice.h"
9 #include "SkDraw.h"
9 #include "SkMetaData.h" 10 #include "SkMetaData.h"
11 #include "SkPatchUtils.h"
10 12
11 SkBaseDevice::SkBaseDevice() 13 SkBaseDevice::SkBaseDevice()
12 : fLeakyProperties(SkDeviceProperties::MakeDefault()) 14 : fLeakyProperties(SkDeviceProperties::MakeDefault())
13 #ifdef SK_DEBUG 15 #ifdef SK_DEBUG
14 , fAttachedToCanvas(false) 16 , fAttachedToCanvas(false)
15 #endif 17 #endif
16 { 18 {
17 fOrigin.setZero(); 19 fOrigin.setZero();
18 fMetaData = NULL; 20 fMetaData = NULL;
19 } 21 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 SkPath path; 72 SkPath path;
71 path.addRRect(outer); 73 path.addRRect(outer);
72 path.addRRect(inner); 74 path.addRRect(inner);
73 path.setFillType(SkPath::kEvenOdd_FillType); 75 path.setFillType(SkPath::kEvenOdd_FillType);
74 76
75 const SkMatrix* preMatrix = NULL; 77 const SkMatrix* preMatrix = NULL;
76 const bool pathIsMutable = true; 78 const bool pathIsMutable = true;
77 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); 79 this->drawPath(draw, path, paint, preMatrix, pathIsMutable);
78 } 80 }
79 81
82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPatch& patch, const SkP aint& paint) {
83 SkPatch::VertexData data;
84
85 SkISize lod = SkPatchUtils::GetLevelOfDetail(patch, draw.fMatrix);
86
87 // It automatically adjusts lodX and lodY in case it exceeds the number of i ndices.
88 patch.getVertexData(&data, lod.width(), lod.height());
89 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints,
90 data.fTexCoords, data.fColors, NULL, data.fIndices, data. fIndexCount, paint);
91 }
92
80 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) { 93 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) {
81 #ifdef SK_DEBUG 94 #ifdef SK_DEBUG
82 SkASSERT(info.width() > 0 && info.height() > 0); 95 SkASSERT(info.width() > 0 && info.height() > 0);
83 SkASSERT(dstP); 96 SkASSERT(dstP);
84 SkASSERT(rowBytes >= info.minRowBytes()); 97 SkASSERT(rowBytes >= info.minRowBytes());
85 SkASSERT(x >= 0 && y >= 0); 98 SkASSERT(x >= 0 && y >= 0);
86 99
87 const SkImageInfo& srcInfo = this->imageInfo(); 100 const SkImageInfo& srcInfo = this->imageInfo();
88 SkASSERT(x + info.width() <= srcInfo.width()); 101 SkASSERT(x + info.width() <= srcInfo.width());
89 SkASSERT(y + info.height() <= srcInfo.height()); 102 SkASSERT(y + info.height() <= srcInfo.height());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 144 }
132 145
133 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { 146 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
134 // The base class doesn't perform any analysis but derived classes may 147 // The base class doesn't perform any analysis but derived classes may
135 } 148 }
136 149
137 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* p icture) { 150 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* p icture) {
138 // The base class doesn't perform any accelerated picture rendering 151 // The base class doesn't perform any accelerated picture rendering
139 return false; 152 return false;
140 } 153 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698