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

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

Issue 473633002: SkTextBlob (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Consolidated blob constructor + comments. 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
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 "SkDraw.h"
10 #include "SkMetaData.h" 10 #include "SkMetaData.h"
11 #include "SkPatchUtils.h" 11 #include "SkPatchUtils.h"
12 #include "SkTextBlob.h"
12 13
13 SkBaseDevice::SkBaseDevice() 14 SkBaseDevice::SkBaseDevice()
14 : fLeakyProperties(SkDeviceProperties::MakeDefault()) 15 : fLeakyProperties(SkDeviceProperties::MakeDefault())
15 #ifdef SK_DEBUG 16 #ifdef SK_DEBUG
16 , fAttachedToCanvas(false) 17 , fAttachedToCanvas(false)
17 #endif 18 #endif
18 { 19 {
19 fOrigin.setZero(); 20 fOrigin.setZero();
20 fMetaData = NULL; 21 fMetaData = NULL;
21 } 22 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix); 87 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix);
87 88
88 // It automatically adjusts lodX and lodY in case it exceeds the number of i ndices. 89 // It automatically adjusts lodX and lodY in case it exceeds the number of i ndices.
89 SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), l od.height()); 90 SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), l od.height());
90 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints, 91 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints,
91 data.fTexCoords, data.fColors, xmode, data.fIndices, data .fIndexCount, 92 data.fTexCoords, data.fColors, xmode, data.fIndices, data .fIndexCount,
92 paint); 93 paint);
93 } 94 }
94 95
96 void SkBaseDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob *blob, cons t SkPaint &paint) {
97 SkTextBlob::Iter iter(blob);
98 while (const SkTextChunk* chunk = iter.next()) {
99 chunk->draw(this, draw, paint);
100 }
101 }
102
95 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) { 103 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt es, int x, int y) {
96 #ifdef SK_DEBUG 104 #ifdef SK_DEBUG
97 SkASSERT(info.width() > 0 && info.height() > 0); 105 SkASSERT(info.width() > 0 && info.height() > 0);
98 SkASSERT(dstP); 106 SkASSERT(dstP);
99 SkASSERT(rowBytes >= info.minRowBytes()); 107 SkASSERT(rowBytes >= info.minRowBytes());
100 SkASSERT(x >= 0 && y >= 0); 108 SkASSERT(x >= 0 && y >= 0);
101 109
102 const SkImageInfo& srcInfo = this->imageInfo(); 110 const SkImageInfo& srcInfo = this->imageInfo();
103 SkASSERT(x + info.width() <= srcInfo.width()); 111 SkASSERT(x + info.width() <= srcInfo.width());
104 SkASSERT(y + info.height() <= srcInfo.height()); 112 SkASSERT(y + info.height() <= srcInfo.height());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 155
148 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { 156 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
149 // The base class doesn't perform any analysis but derived classes may 157 // The base class doesn't perform any analysis but derived classes may
150 } 158 }
151 159
152 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*, 160 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S kMatrix*,
153 const SkPaint*) { 161 const SkPaint*) {
154 // The base class doesn't perform any accelerated picture rendering 162 // The base class doesn't perform any accelerated picture rendering
155 return false; 163 return false;
156 } 164 }
OLDNEW
« include/core/SkTextBlob.h ('K') | « src/core/SkCanvas.cpp ('k') | src/core/SkPictureFlat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698