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

Side by Side Diff: tools/debugger/SkDrawCommand.cpp

Issue 2146073003: Creating framework for drawShadowedPicture (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Fixed 'const sk_sp<SkLights>', also fixed some crumbs from merging Created 4 years, 5 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
« src/core/SkPictureFlat.h ('K') | « tools/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 , fVisible(true) { 173 , fVisible(true) {
174 } 174 }
175 175
176 SkDrawCommand::~SkDrawCommand() { 176 SkDrawCommand::~SkDrawCommand() {
177 fInfo.deleteAll(); 177 fInfo.deleteAll();
178 } 178 }
179 179
180 const char* SkDrawCommand::GetCommandString(OpType type) { 180 const char* SkDrawCommand::GetCommandString(OpType type) {
181 switch (type) { 181 switch (type) {
182 case kBeginDrawPicture_OpType: return "BeginDrawPicture"; 182 case kBeginDrawPicture_OpType: return "BeginDrawPicture";
183 case kBeginDrawShadowedPicture_OpType: return "BeginDrawShadowedPicture" ;
183 case kClipPath_OpType: return "ClipPath"; 184 case kClipPath_OpType: return "ClipPath";
184 case kClipRegion_OpType: return "ClipRegion"; 185 case kClipRegion_OpType: return "ClipRegion";
185 case kClipRect_OpType: return "ClipRect"; 186 case kClipRect_OpType: return "ClipRect";
186 case kClipRRect_OpType: return "ClipRRect"; 187 case kClipRRect_OpType: return "ClipRRect";
187 case kConcat_OpType: return "Concat"; 188 case kConcat_OpType: return "Concat";
188 case kDrawAnnotation_OpType: return "DrawAnnotation"; 189 case kDrawAnnotation_OpType: return "DrawAnnotation";
189 case kDrawBitmap_OpType: return "DrawBitmap"; 190 case kDrawBitmap_OpType: return "DrawBitmap";
190 case kDrawBitmapNine_OpType: return "DrawBitmapNine"; 191 case kDrawBitmapNine_OpType: return "DrawBitmapNine";
191 case kDrawBitmapRect_OpType: return "DrawBitmapRect"; 192 case kDrawBitmapRect_OpType: return "DrawBitmapRect";
192 case kDrawClear_OpType: return "DrawClear"; 193 case kDrawClear_OpType: return "DrawClear";
193 case kDrawDRRect_OpType: return "DrawDRRect"; 194 case kDrawDRRect_OpType: return "DrawDRRect";
194 case kDrawImage_OpType: return "DrawImage"; 195 case kDrawImage_OpType: return "DrawImage";
195 case kDrawImageRect_OpType: return "DrawImageRect"; 196 case kDrawImageRect_OpType: return "DrawImageRect";
196 case kDrawOval_OpType: return "DrawOval"; 197 case kDrawOval_OpType: return "DrawOval";
197 case kDrawPaint_OpType: return "DrawPaint"; 198 case kDrawPaint_OpType: return "DrawPaint";
198 case kDrawPatch_OpType: return "DrawPatch"; 199 case kDrawPatch_OpType: return "DrawPatch";
199 case kDrawPath_OpType: return "DrawPath"; 200 case kDrawPath_OpType: return "DrawPath";
200 case kDrawPoints_OpType: return "DrawPoints"; 201 case kDrawPoints_OpType: return "DrawPoints";
201 case kDrawPosText_OpType: return "DrawPosText"; 202 case kDrawPosText_OpType: return "DrawPosText";
202 case kDrawPosTextH_OpType: return "DrawPosTextH"; 203 case kDrawPosTextH_OpType: return "DrawPosTextH";
203 case kDrawRect_OpType: return "DrawRect"; 204 case kDrawRect_OpType: return "DrawRect";
204 case kDrawRRect_OpType: return "DrawRRect"; 205 case kDrawRRect_OpType: return "DrawRRect";
205 case kDrawText_OpType: return "DrawText"; 206 case kDrawText_OpType: return "DrawText";
206 case kDrawTextBlob_OpType: return "DrawTextBlob"; 207 case kDrawTextBlob_OpType: return "DrawTextBlob";
207 case kDrawTextOnPath_OpType: return "DrawTextOnPath"; 208 case kDrawTextOnPath_OpType: return "DrawTextOnPath";
208 case kDrawTextRSXform_OpType: return "DrawTextRSXform"; 209 case kDrawTextRSXform_OpType: return "DrawTextRSXform";
209 case kDrawVertices_OpType: return "DrawVertices"; 210 case kDrawVertices_OpType: return "DrawVertices";
210 case kEndDrawPicture_OpType: return "EndDrawPicture"; 211 case kEndDrawPicture_OpType: return "EndDrawPicture";
212 case kEndDrawShadowedPicture_OpType: return "EndDrawShadowedPicture";
211 case kRestore_OpType: return "Restore"; 213 case kRestore_OpType: return "Restore";
212 case kSave_OpType: return "Save"; 214 case kSave_OpType: return "Save";
213 case kSaveLayer_OpType: return "SaveLayer"; 215 case kSaveLayer_OpType: return "SaveLayer";
214 case kSetMatrix_OpType: return "SetMatrix"; 216 case kSetMatrix_OpType: return "SetMatrix";
215 case kTranslateZ_OpType: return "TranslateZ"; 217 case kTranslateZ_OpType: return "TranslateZ";
216 default: 218 default:
217 SkDebugf("OpType error 0x%08x\n", type); 219 SkDebugf("OpType error 0x%08x\n", type);
218 SkASSERT(0); 220 SkASSERT(0);
219 break; 221 break;
220 } 222 }
(...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 2376
2375 SkEndDrawPictureCommand::SkEndDrawPictureCommand(bool restore) 2377 SkEndDrawPictureCommand::SkEndDrawPictureCommand(bool restore)
2376 : INHERITED(kEndDrawPicture_OpType) , fRestore(restore) { } 2378 : INHERITED(kEndDrawPicture_OpType) , fRestore(restore) { }
2377 2379
2378 void SkEndDrawPictureCommand::execute(SkCanvas* canvas) const { 2380 void SkEndDrawPictureCommand::execute(SkCanvas* canvas) const {
2379 if (fRestore) { 2381 if (fRestore) {
2380 canvas->restore(); 2382 canvas->restore();
2381 } 2383 }
2382 } 2384 }
2383 2385
2386 SkBeginDrawShadowedPictureCommand::SkBeginDrawShadowedPictureCommand(const SkPic ture* picture,
2387 sk_sp<SkLig hts> lights)
2388 : INHERITED(kBeginDrawShadowedPicture_OpType)
2389 , fPicture(SkRef(picture))
2390 , fMatrix(nullptr)
2391 , fPaint(nullptr) {
2392
2393 SkString* str = new SkString;
2394 str->appendf("SkPicture: L: %f T: %f R: %f B: %f",
2395 picture->cullRect().fLeft, picture->cullRect().fTop,
2396 picture->cullRect().fRight, picture->cullRect().fBottom);
2397 fInfo.push(str);
2398 }
2399
2400 void SkBeginDrawShadowedPictureCommand::execute(SkCanvas* canvas) const {
2401 canvas->save();
2402 }
2403
2404 bool SkBeginDrawShadowedPictureCommand::render(SkCanvas* canvas) const {
2405 canvas->clear(0xFFFFFFFF);
2406 canvas->save();
2407
2408 xlate_and_scale_to_bounds(canvas, fPicture->cullRect());
2409
2410 canvas->drawPicture(fPicture.get());
2411
2412 canvas->restore();
2413
2414 return true;
2415 }
2416
2417 SkEndDrawShadowedPictureCommand::SkEndDrawShadowedPictureCommand(bool restore)
2418 : INHERITED(kEndDrawShadowedPicture_OpType) , fRestore(restore) { }
2419
2420 void SkEndDrawShadowedPictureCommand::execute(SkCanvas* canvas) const {
2421 if (fRestore) {
2422 canvas->restore();
2423 }
2424 }
2425
2384 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, 2426 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count,
2385 const SkPoint pts[], const SkPaint& pai nt) 2427 const SkPoint pts[], const SkPaint& pai nt)
2386 : INHERITED(kDrawPoints_OpType) { 2428 : INHERITED(kDrawPoints_OpType) {
2387 fMode = mode; 2429 fMode = mode;
2388 fCount = count; 2430 fCount = count;
2389 fPts = new SkPoint[count]; 2431 fPts = new SkPoint[count];
2390 memcpy(fPts, pts, count * sizeof(SkPoint)); 2432 memcpy(fPts, pts, count * sizeof(SkPoint));
2391 fPaint = paint; 2433 fPaint = paint;
2392 2434
2393 fInfo.push(SkObjectParser::PointsToString(pts, count)); 2435 fInfo.push(SkObjectParser::PointsToString(pts, count));
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
3325 result[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS] = MakeJsonScalar(fZTranslate) ; 3367 result[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS] = MakeJsonScalar(fZTranslate) ;
3326 return result; 3368 return result;
3327 } 3369 }
3328 3370
3329 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command, 3371 SkTranslateZCommand* SkTranslateZCommand::fromJSON(Json::Value& command,
3330 UrlDataManager& urlDataManager) { 3372 UrlDataManager& urlDataManager) {
3331 SkScalar z; 3373 SkScalar z;
3332 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z); 3374 extract_json_scalar(command[SKDEBUGCANVAS_ATTRIBUTE_DRAWDEPTHTRANS], &z);
3333 return new SkTranslateZCommand(z); 3375 return new SkTranslateZCommand(z);
3334 } 3376 }
OLDNEW
« src/core/SkPictureFlat.h ('K') | « tools/debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698