OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #ifndef SkGatherPixelRefsAndRects_DEFINED | 8 #ifndef SkGatherPixelRefsAndRects_DEFINED |
9 #define SkGatherPixelRefsAndRects_DEFINED | 9 #define SkGatherPixelRefsAndRects_DEFINED |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 virtual void drawPath(const SkDraw& draw, const SkPath& path, | 97 virtual void drawPath(const SkDraw& draw, const SkPath& path, |
98 const SkPaint& paint, const SkMatrix* prePathMatrix, | 98 const SkPaint& paint, const SkMatrix* prePathMatrix, |
99 bool pathIsMutable) SK_OVERRIDE { | 99 bool pathIsMutable) SK_OVERRIDE { |
100 SkBitmap bm; | 100 SkBitmap bm; |
101 if (!GetBitmapFromPaint(paint, &bm)) { | 101 if (!GetBitmapFromPaint(paint, &bm)) { |
102 return; | 102 return; |
103 } | 103 } |
104 | 104 |
105 SkRect pathBounds = path.getBounds(); | 105 SkRect pathBounds = path.getBounds(); |
106 if (NULL != prePathMatrix) { | 106 if (prePathMatrix) { |
107 prePathMatrix->mapRect(&pathBounds); | 107 prePathMatrix->mapRect(&pathBounds); |
108 } | 108 } |
109 | 109 |
110 this->drawRect(draw, pathBounds, paint); | 110 this->drawRect(draw, pathBounds, paint); |
111 } | 111 } |
112 virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, | 112 virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
113 const SkMatrix& matrix, const SkPaint& paint) SK_OVE
RRIDE { | 113 const SkMatrix& matrix, const SkPaint& paint) SK_OVE
RRIDE { |
114 SkMatrix totMatrix; | 114 SkMatrix totMatrix; |
115 totMatrix.setConcat(*draw.fMatrix, matrix); | 115 totMatrix.setConcat(*draw.fMatrix, matrix); |
116 | 116 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 private: | 290 private: |
291 SkPictureUtils::SkPixelRefContainer* fPRCont; | 291 SkPictureUtils::SkPixelRefContainer* fPRCont; |
292 SkISize fSize; | 292 SkISize fSize; |
293 | 293 |
294 SkBitmap fEmptyBitmap; // legacy -- need to remo
ve | 294 SkBitmap fEmptyBitmap; // legacy -- need to remo
ve |
295 | 295 |
296 static bool GetBitmapFromPaint(const SkPaint &paint, SkBitmap* bitmap) { | 296 static bool GetBitmapFromPaint(const SkPaint &paint, SkBitmap* bitmap) { |
297 SkShader* shader = paint.getShader(); | 297 SkShader* shader = paint.getShader(); |
298 if (NULL != shader) { | 298 if (shader) { |
299 if (SkShader::kNone_GradientType == shader->asAGradient(NULL)) { | 299 if (SkShader::kNone_GradientType == shader->asAGradient(NULL)) { |
300 return SkShader::kNone_BitmapType != shader->asABitmap(bitmap, N
ULL, NULL); | 300 return SkShader::kNone_BitmapType != shader->asABitmap(bitmap, N
ULL, NULL); |
301 } | 301 } |
302 } | 302 } |
303 return false; | 303 return false; |
304 } | 304 } |
305 | 305 |
306 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE { | 306 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE { |
307 NotSupported(); | 307 NotSupported(); |
308 } | 308 } |
309 | 309 |
310 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S
K_OVERRIDE { | 310 virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) S
K_OVERRIDE { |
311 // we expect to only get called via savelayer, in which case it is fine. | 311 // we expect to only get called via savelayer, in which case it is fine. |
312 SkASSERT(kSaveLayer_Usage == usage); | 312 SkASSERT(kSaveLayer_Usage == usage); |
313 return SkNEW_ARGS(SkGatherPixelRefsAndRectsDevice, | 313 return SkNEW_ARGS(SkGatherPixelRefsAndRectsDevice, |
314 (info.width(), info.height(), fPRCont)); | 314 (info.width(), info.height(), fPRCont)); |
315 } | 315 } |
316 | 316 |
317 static void NotSupported() { | 317 static void NotSupported() { |
318 SkDEBUGFAIL("this method should never be called"); | 318 SkDEBUGFAIL("this method should never be called"); |
319 } | 319 } |
320 | 320 |
321 static void NothingToDo() {} | 321 static void NothingToDo() {} |
322 | 322 |
323 typedef SkBaseDevice INHERITED; | 323 typedef SkBaseDevice INHERITED; |
324 }; | 324 }; |
325 | 325 |
326 #endif // SkGatherPixelRefsAndRects_DEFINED | 326 #endif // SkGatherPixelRefsAndRects_DEFINED |
OLD | NEW |