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

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 15057005: Remove duplicated code in SkPictureRecord::drawRRect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) { 921 void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
922 // op + paint index + rect 922 // op + paint index + rect
923 uint32_t size = 2 * kUInt32Size + sizeof(rect); 923 uint32_t size = 2 * kUInt32Size + sizeof(rect);
924 uint32_t initialOffset = this->addDraw(DRAW_RECT, &size); 924 uint32_t initialOffset = this->addDraw(DRAW_RECT, &size);
925 SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size()); 925 SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size());
926 addPaint(paint); 926 addPaint(paint);
927 addRect(rect); 927 addRect(rect);
928 validate(initialOffset, size); 928 validate(initialOffset, size);
929 } 929 }
930 930
931 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 931 void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
robertphillips 2013/05/10 14:08:40 Could also move these into the final else block
932 uint32_t initialOffset, size; 932 uint32_t initialOffset, size;
933 if (rrect.isRect()) { 933 if (rrect.isRect()) {
934 // op + paint index + rect 934 this->SkPictureRecord::drawRect(rrect.getBounds(), paint);
935 size = 2 * kUInt32Size + sizeof(SkRect);
936 initialOffset = this->addDraw(DRAW_RECT, &size);
937 SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size() );
938 addPaint(paint);
939 addRect(rrect.getBounds());
940 } else if (rrect.isOval()) { 935 } else if (rrect.isOval()) {
941 // op + paint index + rect 936 this->SkPictureRecord::drawOval(rrect.getBounds(), paint);
942 size = 2 * kUInt32Size + sizeof(SkRect);
943 initialOffset = this->addDraw(DRAW_OVAL, &size);
944 SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size() );
945 addPaint(paint);
946 addRect(rrect.getBounds());
947 } else { 937 } else {
948 // op + paint index + rrect 938 // op + paint index + rrect
949 size = 2 * kUInt32Size + SkRRect::kSizeInMemory; 939 size = 2 * kUInt32Size + SkRRect::kSizeInMemory;
950 initialOffset = this->addDraw(DRAW_RRECT, &size); 940 initialOffset = this->addDraw(DRAW_RRECT, &size);
951 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size( )); 941 SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size( ));
952 addPaint(paint); 942 addPaint(paint);
953 addRRect(rrect); 943 addRRect(rrect);
944 validate(initialOffset, size);
954 } 945 }
955 validate(initialOffset, size);
956 } 946 }
957 947
958 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { 948 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
959 // op + paint index + path index 949 // op + paint index + path index
960 uint32_t size = 3 * kUInt32Size; 950 uint32_t size = 3 * kUInt32Size;
961 uint32_t initialOffset = this->addDraw(DRAW_PATH, &size); 951 uint32_t initialOffset = this->addDraw(DRAW_PATH, &size);
962 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size()); 952 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size());
963 addPaint(paint); 953 addPaint(paint);
964 addPath(path); 954 addPath(path);
965 validate(initialOffset, size); 955 validate(initialOffset, size);
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 void SkPictureRecord::validateRegions() const { 1512 void SkPictureRecord::validateRegions() const {
1523 int count = fRegions.count(); 1513 int count = fRegions.count();
1524 SkASSERT((unsigned) count < 0x1000); 1514 SkASSERT((unsigned) count < 0x1000);
1525 for (int index = 0; index < count; index++) { 1515 for (int index = 0; index < count; index++) {
1526 const SkFlatData* region = fRegions[index]; 1516 const SkFlatData* region = fRegions[index];
1527 SkASSERT(region); 1517 SkASSERT(region);
1528 // region->validate(); 1518 // region->validate();
1529 } 1519 }
1530 } 1520 }
1531 #endif 1521 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698