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

Side by Side Diff: src/pipe/SkGPipeRead.cpp

Issue 112913005: reenable vertices gm, adding picture support (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | 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 2011 Google Inc. 3 * Copyright 2011 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 "SkBitmapHeap.h" 10 #include "SkBitmapHeap.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 reader->readPath(&path); 402 reader->readPath(&path);
403 if (state->shouldDraw()) { 403 if (state->shouldDraw()) {
404 canvas->drawPath(path, state->paint()); 404 canvas->drawPath(path, state->paint());
405 } 405 }
406 } 406 }
407 407
408 static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 408 static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
409 SkGPipeState* state) { 409 SkGPipeState* state) {
410 unsigned flags = DrawOp_unpackFlags(op32); 410 unsigned flags = DrawOp_unpackFlags(op32);
411 411
412 SkCanvas::VertexMode mode = (SkCanvas::VertexMode)reader->readU32(); 412 SkCanvas::VertexMode vmode = (SkCanvas::VertexMode)reader->readU32();
413 int vertexCount = reader->readU32(); 413 int vertexCount = reader->readU32();
414 const SkPoint* verts = skip<SkPoint>(reader, vertexCount); 414 const SkPoint* verts = skip<SkPoint>(reader, vertexCount);
415 415
416 const SkPoint* texs = NULL; 416 const SkPoint* texs = NULL;
417 if (flags & kDrawVertices_HasTexs_DrawOpFlag) { 417 if (flags & kDrawVertices_HasTexs_DrawOpFlag) {
418 texs = skip<SkPoint>(reader, vertexCount); 418 texs = skip<SkPoint>(reader, vertexCount);
419 } 419 }
420 420
421 const SkColor* colors = NULL; 421 const SkColor* colors = NULL;
422 if (flags & kDrawVertices_HasColors_DrawOpFlag) { 422 if (flags & kDrawVertices_HasColors_DrawOpFlag) {
423 colors = skip<SkColor>(reader, vertexCount); 423 colors = skip<SkColor>(reader, vertexCount);
424 } 424 }
425 425
426 // TODO: flatten/unflatten xfermodes 426 SkAutoTUnref<SkXfermode> xfer;
427 SkXfermode* xfer = NULL; 427 if (flags & kDrawVertices_HasXfermode_DrawOpFlag) {
428 SkXfermode::Mode mode = (SkXfermode::Mode)reader->readU32();
429 xfer.reset(SkXfermode::Create(mode));
430 }
428 431
429 int indexCount = 0; 432 int indexCount = 0;
430 const uint16_t* indices = NULL; 433 const uint16_t* indices = NULL;
431 if (flags & kDrawVertices_HasIndices_DrawOpFlag) { 434 if (flags & kDrawVertices_HasIndices_DrawOpFlag) {
432 indexCount = reader->readU32(); 435 indexCount = reader->readU32();
433 indices = skipAlign<uint16_t>(reader, indexCount); 436 indices = skipAlign<uint16_t>(reader, indexCount);
434 } 437 }
435 if (state->shouldDraw()) { 438 if (state->shouldDraw()) {
436 canvas->drawVertices(mode, vertexCount, verts, texs, colors, xfer, 439 canvas->drawVertices(vmode, vertexCount, verts, texs, colors, xfer,
437 indices, indexCount, state->paint()); 440 indices, indexCount, state->paint());
438 } 441 }
439 } 442 }
440 443
441 /////////////////////////////////////////////////////////////////////////////// 444 ///////////////////////////////////////////////////////////////////////////////
442 445
443 static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 446 static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
444 SkGPipeState* state) { 447 SkGPipeState* state) {
445 size_t len = reader->readU32(); 448 size_t len = reader->readU32();
446 const void* text = reader->skip(SkAlign4(len)); 449 const void* text = reader->skip(SkAlign4(len));
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 status = kReadAtom_Status; 887 status = kReadAtom_Status;
885 break; 888 break;
886 } 889 }
887 } 890 }
888 891
889 if (bytesRead) { 892 if (bytesRead) {
890 *bytesRead = reader.offset(); 893 *bytesRead = reader.offset();
891 } 894 }
892 return status; 895 return status;
893 } 896 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698