OLD | NEW |
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" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 SkPath path; | 72 SkPath path; |
73 path.addRRect(outer); | 73 path.addRRect(outer); |
74 path.addRRect(inner); | 74 path.addRRect(inner); |
75 path.setFillType(SkPath::kEvenOdd_FillType); | 75 path.setFillType(SkPath::kEvenOdd_FillType); |
76 | 76 |
77 const SkMatrix* preMatrix = NULL; | 77 const SkMatrix* preMatrix = NULL; |
78 const bool pathIsMutable = true; | 78 const bool pathIsMutable = true; |
79 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); | 79 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); |
80 } | 80 } |
81 | 81 |
82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPatch& patch, const SkP
aint& paint) { | 82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const
SkColor colors[4], |
83 SkPatch::VertexData data; | 83 const SkPoint texCoords[4], SkXfermode* xmode, cons
t SkPaint& paint) { |
| 84 SkPatchUtils::VertexData data; |
84 | 85 |
85 SkISize lod = SkPatchUtils::GetLevelOfDetail(patch, draw.fMatrix); | 86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix); |
86 | 87 |
87 // It automatically adjusts lodX and lodY in case it exceeds the number of i
ndices. | 88 // It automatically adjusts lodX and lodY in case it exceeds the number of i
ndices. |
88 patch.getVertexData(&data, lod.width(), lod.height()); | 89 SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), l
od.height()); |
89 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount,
data.fPoints, | 90 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount,
data.fPoints, |
90 data.fTexCoords, data.fColors, NULL, data.fIndices, data.
fIndexCount, paint); | 91 data.fTexCoords, data.fColors, xmode, data.fIndices, data
.fIndexCount, |
| 92 paint); |
91 } | 93 } |
92 | 94 |
93 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { | 95 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { |
94 #ifdef SK_DEBUG | 96 #ifdef SK_DEBUG |
95 SkASSERT(info.width() > 0 && info.height() > 0); | 97 SkASSERT(info.width() > 0 && info.height() > 0); |
96 SkASSERT(dstP); | 98 SkASSERT(dstP); |
97 SkASSERT(rowBytes >= info.minRowBytes()); | 99 SkASSERT(rowBytes >= info.minRowBytes()); |
98 SkASSERT(x >= 0 && y >= 0); | 100 SkASSERT(x >= 0 && y >= 0); |
99 | 101 |
100 const SkImageInfo& srcInfo = this->imageInfo(); | 102 const SkImageInfo& srcInfo = this->imageInfo(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 147 |
146 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { | 148 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { |
147 // The base class doesn't perform any analysis but derived classes may | 149 // The base class doesn't perform any analysis but derived classes may |
148 } | 150 } |
149 | 151 |
150 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, | 152 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, |
151 const SkPaint*) { | 153 const SkPaint*) { |
152 // The base class doesn't perform any accelerated picture rendering | 154 // The base class doesn't perform any accelerated picture rendering |
153 return false; | 155 return false; |
154 } | 156 } |
OLD | NEW |