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

Side by Side Diff: debugger/SkDrawCommand.cpp

Issue 12979004: More SkDrawCommand cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkDrawCommand.h" 10 #include "SkDrawCommand.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 this->fInfo.push(SkObjectParser::RegionToString(region)); 107 this->fInfo.push(SkObjectParser::RegionToString(region));
108 this->fInfo.push(SkObjectParser::RegionOpToString(op)); 108 this->fInfo.push(SkObjectParser::RegionOpToString(op));
109 } 109 }
110 110
111 void ClipRegion::execute(SkCanvas* canvas) { 111 void ClipRegion::execute(SkCanvas* canvas) {
112 canvas->clipRegion(*this->fRegion, this->fOp); 112 canvas->clipRegion(*this->fRegion, this->fOp);
113 } 113 }
114 114
115 ClipRect::ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { 115 ClipRect::ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
116 this->fRect = ▭ 116 fRect = rect;
117 this->fOp = op; 117 fOp = op;
118 this->fDoAA = doAA; 118 fDoAA = doAA;
119 this->fDrawType = CLIP_RECT; 119 fDrawType = CLIP_RECT;
120 120
121 this->fInfo.push(SkObjectParser::RectToString(rect)); 121 fInfo.push(SkObjectParser::RectToString(rect));
122 this->fInfo.push(SkObjectParser::RegionOpToString(op)); 122 fInfo.push(SkObjectParser::RegionOpToString(op));
123 this->fInfo.push(SkObjectParser::BoolToString(doAA)); 123 fInfo.push(SkObjectParser::BoolToString(doAA));
124 } 124 }
125 125
126 void ClipRect::execute(SkCanvas* canvas) { 126 void ClipRect::execute(SkCanvas* canvas) {
127 canvas->clipRect(*this->fRect, this->fOp, this->fDoAA); 127 canvas->clipRect(fRect, fOp, fDoAA);
128 } 128 }
129 129
130 ClipRRect::ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) { 130 ClipRRect::ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
131 this->fRRect = rrect; 131 fRRect = rrect;
132 this->fOp = op; 132 fOp = op;
133 this->fDoAA = doAA; 133 fDoAA = doAA;
134 this->fDrawType = CLIP_RRECT; 134 fDrawType = CLIP_RRECT;
135 135
136 this->fInfo.push(SkObjectParser::RRectToString(rrect)); 136 fInfo.push(SkObjectParser::RRectToString(rrect));
137 this->fInfo.push(SkObjectParser::RegionOpToString(op)); 137 fInfo.push(SkObjectParser::RegionOpToString(op));
138 this->fInfo.push(SkObjectParser::BoolToString(doAA)); 138 fInfo.push(SkObjectParser::BoolToString(doAA));
139 } 139 }
140 140
141 void ClipRRect::execute(SkCanvas* canvas) { 141 void ClipRRect::execute(SkCanvas* canvas) {
142 canvas->clipRRect(this->fRRect, this->fOp, this->fDoAA); 142 canvas->clipRRect(fRRect, fOp, fDoAA);
143 } 143 }
144 144
145 Concat::Concat(const SkMatrix& matrix) { 145 Concat::Concat(const SkMatrix& matrix) {
146 this->fMatrix = &matrix; 146 this->fMatrix = &matrix;
147 this->fDrawType = CONCAT; 147 this->fDrawType = CONCAT;
148 148
149 this->fInfo.push(SkObjectParser::MatrixToString(matrix)); 149 this->fInfo.push(SkObjectParser::MatrixToString(matrix));
150 } 150 }
151 151
152 void Concat::execute(SkCanvas* canvas) { 152 void Concat::execute(SkCanvas* canvas) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 this->fLength = length; 269 this->fLength = length;
270 this->fDrawType = DRAW_DATA; 270 this->fDrawType = DRAW_DATA;
271 // TODO(chudy): See if we can't display data and length. 271 // TODO(chudy): See if we can't display data and length.
272 } 272 }
273 273
274 void DrawData::execute(SkCanvas* canvas) { 274 void DrawData::execute(SkCanvas* canvas) {
275 canvas->drawData(this->fData, this->fLength); 275 canvas->drawData(this->fData, this->fLength);
276 } 276 }
277 277
278 DrawOval::DrawOval(const SkRect& oval, const SkPaint& paint) { 278 DrawOval::DrawOval(const SkRect& oval, const SkPaint& paint) {
279 this->fOval = &oval; 279 fOval = oval;
280 this->fPaint = &paint; 280 fPaint = paint;
281 this->fDrawType = DRAW_OVAL; 281 fDrawType = DRAW_OVAL;
282 282
283 this->fInfo.push(SkObjectParser::RectToString(oval)); 283 fInfo.push(SkObjectParser::RectToString(oval));
284 this->fInfo.push(SkObjectParser::PaintToString(paint)); 284 fInfo.push(SkObjectParser::PaintToString(paint));
285 } 285 }
286 286
287 void DrawOval::execute(SkCanvas* canvas) { 287 void DrawOval::execute(SkCanvas* canvas) {
288 canvas->drawOval(*this->fOval, *this->fPaint); 288 canvas->drawOval(fOval, fPaint);
289 } 289 }
290 290
291 DrawPaint::DrawPaint(const SkPaint& paint) { 291 DrawPaint::DrawPaint(const SkPaint& paint) {
292 this->fPaint = &paint; 292 fPaint = paint;
293 this->fDrawType = DRAW_PAINT; 293 fDrawType = DRAW_PAINT;
294 294
295 this->fInfo.push(SkObjectParser::PaintToString(paint)); 295 fInfo.push(SkObjectParser::PaintToString(paint));
296 } 296 }
297 297
298 void DrawPaint::execute(SkCanvas* canvas) { 298 void DrawPaint::execute(SkCanvas* canvas) {
299 canvas->drawPaint(*this->fPaint); 299 canvas->drawPaint(fPaint);
300 } 300 }
301 301
302 DrawPath::DrawPath(const SkPath& path, const SkPaint& paint, SkBitmap& bitmap) { 302 DrawPath::DrawPath(const SkPath& path, const SkPaint& paint, SkBitmap& bitmap) {
303 fPath = path; 303 fPath = path;
304 fPaint = paint; 304 fPaint = paint;
305 fBitmap = bitmap; 305 fBitmap = bitmap;
306 fDrawType = DRAW_PATH; 306 fDrawType = DRAW_PATH;
307 307
308 fInfo.push(SkObjectParser::PathToString(path)); 308 fInfo.push(SkObjectParser::PathToString(path));
309 fInfo.push(SkObjectParser::PaintToString(paint)); 309 fInfo.push(SkObjectParser::PaintToString(paint));
(...skipping 11 matching lines...) Expand all
321 this->fPicture = &picture; 321 this->fPicture = &picture;
322 this->fDrawType = DRAW_PICTURE; 322 this->fDrawType = DRAW_PICTURE;
323 this->fInfo.push(SkObjectParser::CustomTextToString("To be implemented.")); 323 this->fInfo.push(SkObjectParser::CustomTextToString("To be implemented."));
324 } 324 }
325 325
326 void DrawPicture::execute(SkCanvas* canvas) { 326 void DrawPicture::execute(SkCanvas* canvas) {
327 canvas->drawPicture(*this->fPicture); 327 canvas->drawPicture(*this->fPicture);
328 } 328 }
329 329
330 DrawPoints::DrawPoints(SkCanvas::PointMode mode, size_t count, 330 DrawPoints::DrawPoints(SkCanvas::PointMode mode, size_t count,
331 const SkPoint pts[], const SkPaint& paint) { 331 const SkPoint pts[], const SkPaint& paint) {
332 this->fMode = mode; 332 fMode = mode;
333 this->fCount = count; 333 fCount = count;
334 this->fPts = pts; 334 fPts = new SkPoint[count];
335 this->fPaint = &paint; 335 memcpy(fPts, pts, count * sizeof(SkPoint));
336 this->fDrawType = DRAW_POINTS; 336 fPaint = paint;
337 fDrawType = DRAW_POINTS;
337 338
338 this->fInfo.push(SkObjectParser::PointsToString(pts, count)); 339 fInfo.push(SkObjectParser::PointsToString(pts, count));
339 this->fInfo.push(SkObjectParser::ScalarToString(SkIntToScalar((unsigned int) count), 340 fInfo.push(SkObjectParser::ScalarToString(SkIntToScalar((unsigned int)count) ,
340 "Points: ")); 341 "Points: "));
341 this->fInfo.push(SkObjectParser::PointModeToString(mode)); 342 fInfo.push(SkObjectParser::PointModeToString(mode));
342 this->fInfo.push(SkObjectParser::PaintToString(paint)); 343 fInfo.push(SkObjectParser::PaintToString(paint));
343 } 344 }
344 345
345 void DrawPoints::execute(SkCanvas* canvas) { 346 void DrawPoints::execute(SkCanvas* canvas) {
346 canvas->drawPoints(this->fMode, this->fCount, this->fPts, *this->fPaint); 347 canvas->drawPoints(fMode, fCount, fPts, fPaint);
347 } 348 }
348 349
349 DrawPosText::DrawPosText(const void* text, size_t byteLength, const SkPoint pos[ ], 350 DrawPosText::DrawPosText(const void* text, size_t byteLength, const SkPoint pos[ ],
350 const SkPaint& paint) { 351 const SkPaint& paint) {
351 this->fText = text; 352 size_t numPts = paint.countText(text, byteLength);
352 this->fByteLength = byteLength;
353 this->fPos = pos;
354 this->fPaint = &paint;
355 this->fDrawType = DRAW_POS_TEXT;
356 353
357 this->fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTex tEncoding())); 354 fText = new char[byteLength];
355 memcpy(fText, text, byteLength);
356 fByteLength = byteLength;
357
358 fPos = new SkPoint[numPts];
359 memcpy(fPos, pos, numPts * sizeof(SkPoint));
360
361 fPaint = paint;
362 fDrawType = DRAW_POS_TEXT;
363
364 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
358 // TODO(chudy): Test that this works. 365 // TODO(chudy): Test that this works.
359 this->fInfo.push(SkObjectParser::PointsToString(pos, 1)); 366 fInfo.push(SkObjectParser::PointsToString(pos, 1));
360 this->fInfo.push(SkObjectParser::PaintToString(paint)); 367 fInfo.push(SkObjectParser::PaintToString(paint));
361 } 368 }
362 369
363 void DrawPosText::execute(SkCanvas* canvas) { 370 void DrawPosText::execute(SkCanvas* canvas) {
364 canvas->drawPosText(this->fText, this->fByteLength, this->fPos, *this->fPain t); 371 canvas->drawPosText(fText, fByteLength, fPos, fPaint);
365 } 372 }
366 373
367 374
368 DrawPosTextH::DrawPosTextH(const void* text, size_t byteLength, 375 DrawPosTextH::DrawPosTextH(const void* text, size_t byteLength,
369 const SkScalar xpos[], SkScalar constY, 376 const SkScalar xpos[], SkScalar constY,
370 const SkPaint& paint) { 377 const SkPaint& paint) {
371 fText = text; 378 size_t numPts = paint.countText(text, byteLength);
379
380 fText = new char[byteLength];
381 memcpy(fText, text, byteLength);
372 fByteLength = byteLength; 382 fByteLength = byteLength;
373 fXpos = xpos; 383
384 fXpos = new SkScalar[numPts];
385 memcpy(fXpos, xpos, numPts * sizeof(SkScalar));
386
374 fConstY = constY; 387 fConstY = constY;
375 fPaint = paint; 388 fPaint = paint;
376 fDrawType = DRAW_POS_TEXT_H; 389 fDrawType = DRAW_POS_TEXT_H;
377 390
378 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing())); 391 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod ing()));
379 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); 392 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: "));
380 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); 393 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: "));
381 fInfo.push(SkObjectParser::PaintToString(paint)); 394 fInfo.push(SkObjectParser::PaintToString(paint));
382 } 395 }
383 396
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 this->fDy = dy; 608 this->fDy = dy;
596 this->fDrawType = TRANSLATE; 609 this->fDrawType = TRANSLATE;
597 610
598 this->fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); 611 this->fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: "));
599 this->fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); 612 this->fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: "));
600 } 613 }
601 614
602 void Translate::execute(SkCanvas* canvas) { 615 void Translate::execute(SkCanvas* canvas) {
603 canvas->translate(this->fDx, this->fDy); 616 canvas->translate(this->fDx, this->fDy);
604 } 617 }
OLDNEW
« no previous file with comments | « debugger/SkDrawCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698