OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkDrawCommand.h" | 8 #include "SkDrawCommand.h" |
9 | 9 |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 case kDrawPatch_OpType: return "DrawPatch"; | 197 case kDrawPatch_OpType: return "DrawPatch"; |
198 case kDrawPath_OpType: return "DrawPath"; | 198 case kDrawPath_OpType: return "DrawPath"; |
199 case kDrawPoints_OpType: return "DrawPoints"; | 199 case kDrawPoints_OpType: return "DrawPoints"; |
200 case kDrawPosText_OpType: return "DrawPosText"; | 200 case kDrawPosText_OpType: return "DrawPosText"; |
201 case kDrawPosTextH_OpType: return "DrawPosTextH"; | 201 case kDrawPosTextH_OpType: return "DrawPosTextH"; |
202 case kDrawRect_OpType: return "DrawRect"; | 202 case kDrawRect_OpType: return "DrawRect"; |
203 case kDrawRRect_OpType: return "DrawRRect"; | 203 case kDrawRRect_OpType: return "DrawRRect"; |
204 case kDrawText_OpType: return "DrawText"; | 204 case kDrawText_OpType: return "DrawText"; |
205 case kDrawTextBlob_OpType: return "DrawTextBlob"; | 205 case kDrawTextBlob_OpType: return "DrawTextBlob"; |
206 case kDrawTextOnPath_OpType: return "DrawTextOnPath"; | 206 case kDrawTextOnPath_OpType: return "DrawTextOnPath"; |
207 case kDrawTextRSXform_OpType: return "drawTextRSXform"; | 207 case kDrawTextRSXform_OpType: return "DrawTextRSXform"; |
208 case kDrawVertices_OpType: return "DrawVertices"; | 208 case kDrawVertices_OpType: return "DrawVertices"; |
209 case kEndDrawPicture_OpType: return "EndDrawPicture"; | 209 case kEndDrawPicture_OpType: return "EndDrawPicture"; |
210 case kRestore_OpType: return "Restore"; | 210 case kRestore_OpType: return "Restore"; |
211 case kSave_OpType: return "Save"; | 211 case kSave_OpType: return "Save"; |
212 case kSaveLayer_OpType: return "SaveLayer"; | 212 case kSaveLayer_OpType: return "SaveLayer"; |
213 case kSetMatrix_OpType: return "SetMatrix"; | 213 case kSetMatrix_OpType: return "SetMatrix"; |
214 default: | 214 default: |
215 SkDebugf("OpType error 0x%08x\n", type); | 215 SkDebugf("OpType error 0x%08x\n", type); |
216 SkASSERT(0); | 216 SkASSERT(0); |
217 break; | 217 break; |
(...skipping 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3030 matrixPtr = nullptr; | 3030 matrixPtr = nullptr; |
3031 } | 3031 } |
3032 return new SkDrawTextOnPathCommand(text, strlen(text), path, matrixPtr, pain
t); | 3032 return new SkDrawTextOnPathCommand(text, strlen(text), path, matrixPtr, pain
t); |
3033 } | 3033 } |
3034 | 3034 |
3035 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 3035 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
3036 | 3036 |
3037 SkDrawTextRSXformCommand::SkDrawTextRSXformCommand(const void* text, size_t byte
Length, | 3037 SkDrawTextRSXformCommand::SkDrawTextRSXformCommand(const void* text, size_t byte
Length, |
3038 const SkRSXform xform[], cons
t SkRect* cull, | 3038 const SkRSXform xform[], cons
t SkRect* cull, |
3039 const SkPaint& paint) | 3039 const SkPaint& paint) |
3040 : INHERITED(kDrawTextOnPath_OpType) | 3040 : INHERITED(kDrawTextRSXform_OpType) |
3041 { | 3041 { |
3042 fText = new char[byteLength]; | 3042 fText = new char[byteLength]; |
3043 memcpy(fText, text, byteLength); | 3043 memcpy(fText, text, byteLength); |
3044 fByteLength = byteLength; | 3044 fByteLength = byteLength; |
3045 int count = paint.countText(text, byteLength); | 3045 int count = paint.countText(text, byteLength); |
3046 fXform = new SkRSXform[count]; | 3046 fXform = new SkRSXform[count]; |
3047 memcpy(fXform, xform, count * sizeof(SkRSXform)); | 3047 memcpy(fXform, xform, count * sizeof(SkRSXform)); |
3048 if (cull) { | 3048 if (cull) { |
3049 fCullStorage = *cull; | 3049 fCullStorage = *cull; |
3050 fCull = &fCullStorage; | 3050 fCull = &fCullStorage; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3288 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); | 3288 result[SKDEBUGCANVAS_ATTRIBUTE_MATRIX] = MakeJsonMatrix(fMatrix); |
3289 return result; | 3289 return result; |
3290 } | 3290 } |
3291 | 3291 |
3292 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, | 3292 SkSetMatrixCommand* SkSetMatrixCommand::fromJSON(Json::Value& command, |
3293 UrlDataManager& urlDataManager)
{ | 3293 UrlDataManager& urlDataManager)
{ |
3294 SkMatrix matrix; | 3294 SkMatrix matrix; |
3295 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); | 3295 extract_json_matrix(command[SKDEBUGCANVAS_ATTRIBUTE_MATRIX], &matrix); |
3296 return new SkSetMatrixCommand(matrix); | 3296 return new SkSetMatrixCommand(matrix); |
3297 } | 3297 } |
OLD | NEW |