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

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

Issue 1261433009: Refugee from Dead Machine 11: Add SkCanvas::drawLitAtlas call Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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
« 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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkLight.h"
12 #include "SkPaint.h" 13 #include "SkPaint.h"
13 #include "SkGPipe.h" 14 #include "SkGPipe.h"
14 #include "SkGPipePriv.h" 15 #include "SkGPipePriv.h"
15 #include "SkReader32.h" 16 #include "SkReader32.h"
16 #include "SkStream.h" 17 #include "SkStream.h"
17 18
18 #include "SkAnnotation.h" 19 #include "SkAnnotation.h"
19 #include "SkColorFilter.h" 20 #include "SkColorFilter.h"
20 #include "SkDrawLooper.h" 21 #include "SkDrawLooper.h"
21 #include "SkImageFilter.h" 22 #include "SkImageFilter.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 const SkRect* cull = NULL; 501 const SkRect* cull = NULL;
501 if (flags & kDrawAtlas_HasCull_DrawOpFlag) { 502 if (flags & kDrawAtlas_HasCull_DrawOpFlag) {
502 cull = skip<SkRect>(reader, 1); 503 cull = skip<SkRect>(reader, 1);
503 } 504 }
504 505
505 if (state->shouldDraw()) { 506 if (state->shouldDraw()) {
506 canvas->drawAtlas(atlas, xform, tex, colors, count, mode, cull, paint); 507 canvas->drawAtlas(atlas, xform, tex, colors, count, mode, cull, paint);
507 } 508 }
508 } 509 }
509 510
511 static void drawLitAtlas_rp(SkCanvas* canvas, SkReader32* reader,
512 uint32_t op32, SkGPipeState* state) {
513 unsigned flags = DrawOp_unpackFlags(op32);
514
515 const SkPaint* paint = NULL;
516 if (flags & kDrawAtlas_HasPaint_DrawOpFlag) {
517 paint = &state->paint();
518 }
519 const int slot = reader->readU32();
520 const SkImage* atlas = state->getImage(slot);
521 const int count = reader->readU32();
522 SkXfermode::Mode mode = (SkXfermode::Mode)reader->readU32();
523 const SkRSXform* xform = skip<SkRSXform>(reader, count);
524 const SkRect* diffTex = skip<SkRect>(reader, count);
525 const SkRect* normTex = skip<SkRect>(reader, count);
526 const SkColor* colors = NULL;
527 if (flags & kDrawAtlas_HasColors_DrawOpFlag) {
528 colors = skip<SkColor>(reader, count);
529 }
530 const SkRect* cull = NULL;
531 if (flags & kDrawAtlas_HasCull_DrawOpFlag) {
532 cull = skip<SkRect>(reader, 1);
533 }
534
535 const int numLights = reader->readU32();
536 const SkLight* lights = skip<SkLight>(reader, numLights);
537
538 if (state->shouldDraw()) {
539 canvas->drawLitAtlas(atlas, xform, diffTex, normTex, colors, count, mode , cull,
540 paint, lights, numLights);
541 }
542 }
543
510 /////////////////////////////////////////////////////////////////////////////// 544 ///////////////////////////////////////////////////////////////////////////////
511 545
512 static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 546 static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
513 SkGPipeState* state) { 547 SkGPipeState* state) {
514 size_t len = reader->readU32(); 548 size_t len = reader->readU32();
515 const void* text = reader->skip(SkAlign4(len)); 549 const void* text = reader->skip(SkAlign4(len));
516 const SkScalar* xy = skip<SkScalar>(reader, 2); 550 const SkScalar* xy = skip<SkScalar>(reader, 2);
517 if (state->shouldDraw()) { 551 if (state->shouldDraw()) {
518 canvas->drawText(text, len, xy[0], xy[1], state->paint()); 552 canvas->drawText(text, len, xy[0], xy[1], state->paint());
519 } 553 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 typedef void (*ReadProc)(SkCanvas*, SkReader32*, uint32_t op32, SkGPipeState*); 901 typedef void (*ReadProc)(SkCanvas*, SkReader32*, uint32_t op32, SkGPipeState*);
868 902
869 static const ReadProc gReadTable[] = { 903 static const ReadProc gReadTable[] = {
870 skip_rp, 904 skip_rp,
871 clipPath_rp, 905 clipPath_rp,
872 clipRegion_rp, 906 clipRegion_rp,
873 clipRect_rp, 907 clipRect_rp,
874 clipRRect_rp, 908 clipRRect_rp,
875 concat_rp, 909 concat_rp,
876 drawAtlas_rp, 910 drawAtlas_rp,
911 drawLitAtlas_rp,
877 drawBitmap_rp, 912 drawBitmap_rp,
878 drawBitmapNine_rp, 913 drawBitmapNine_rp,
879 drawBitmapRect_rp, 914 drawBitmapRect_rp,
880 drawDRRect_rp, 915 drawDRRect_rp,
881 drawImage_rp, 916 drawImage_rp,
882 drawImageRect_rp, 917 drawImageRect_rp,
883 drawImageNine_rp, 918 drawImageNine_rp,
884 drawOval_rp, 919 drawOval_rp,
885 drawPaint_rp, 920 drawPaint_rp,
886 drawPatch_rp, 921 drawPatch_rp,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 status = kReadAtom_Status; 1043 status = kReadAtom_Status;
1009 break; 1044 break;
1010 } 1045 }
1011 } 1046 }
1012 1047
1013 if (bytesRead) { 1048 if (bytesRead) {
1014 *bytesRead = reader.offset(); 1049 *bytesRead = reader.offset();
1015 } 1050 }
1016 return status; 1051 return status;
1017 } 1052 }
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