| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SkPoint cubics[12], const
SkColor colors[4], | 82 void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const
SkColor colors[4], |
| 83 const SkPoint texCoords[4], SkXfermode* xmode, cons
t SkPaint& paint) { | 83 const SkPoint texCoords[4], SkXfermode* xmode, cons
t SkPaint& paint) { |
| 84 SkPatchUtils::VertexData data; | 84 SkPatchUtils::VertexData data; |
| 85 | 85 |
| 86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix); | 86 SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix); |
| 87 | 87 |
| 88 // 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. |
| 89 SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), l
od.height()); | 89 // If it fails to generate the vertices, then we do not draw. |
| 90 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount,
data.fPoints, | 90 if (SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(
), lod.height())) { |
| 91 data.fTexCoords, data.fColors, xmode, data.fIndices, data
.fIndexCount, | 91 this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCo
unt, data.fPoints, |
| 92 paint); | 92 data.fTexCoords, data.fColors, xmode, data.fIndices,
data.fIndexCount, |
| 93 paint); |
| 94 } |
| 93 } | 95 } |
| 94 | 96 |
| 95 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { | 97 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { |
| 96 #ifdef SK_DEBUG | 98 #ifdef SK_DEBUG |
| 97 SkASSERT(info.width() > 0 && info.height() > 0); | 99 SkASSERT(info.width() > 0 && info.height() > 0); |
| 98 SkASSERT(dstP); | 100 SkASSERT(dstP); |
| 99 SkASSERT(rowBytes >= info.minRowBytes()); | 101 SkASSERT(rowBytes >= info.minRowBytes()); |
| 100 SkASSERT(x >= 0 && y >= 0); | 102 SkASSERT(x >= 0 && y >= 0); |
| 101 | 103 |
| 102 const SkImageInfo& srcInfo = this->imageInfo(); | 104 const SkImageInfo& srcInfo = this->imageInfo(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 149 |
| 148 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { | 150 void SkBaseDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { |
| 149 // The base class doesn't perform any analysis but derived classes may | 151 // The base class doesn't perform any analysis but derived classes may |
| 150 } | 152 } |
| 151 | 153 |
| 152 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, | 154 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, |
| 153 const SkPaint*) { | 155 const SkPaint*) { |
| 154 // The base class doesn't perform any accelerated picture rendering | 156 // The base class doesn't perform any accelerated picture rendering |
| 155 return false; | 157 return false; |
| 156 } | 158 } |
| OLD | NEW |