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

Side by Side Diff: tests/RecordTest.cpp

Issue 377523002: Only you can prevent memory leaks. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "Test.h" 8 #include "Test.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 SkPaint paint2; 96 SkPaint paint2;
97 // CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader 97 // CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader
98 // gets optimized into a non-bitmap form, so we create a 2x2 bitmap here. 98 // gets optimized into a non-bitmap form, so we create a 2x2 bitmap here.
99 SkBitmap bitmap2; 99 SkBitmap bitmap2;
100 bitmap2.allocPixels(SkImageInfo::MakeN32Premul(2, 2)); 100 bitmap2.allocPixels(SkImageInfo::MakeN32Premul(2, 2));
101 bitmap2.eraseColor(SK_ColorBLUE); 101 bitmap2.eraseColor(SK_ColorBLUE);
102 *(bitmap2.getAddr32(0, 0)) = SK_ColorGREEN; 102 *(bitmap2.getAddr32(0, 0)) = SK_ColorGREEN;
103 SkShader* shader = SkShader::CreateBitmapShader(bitmap2, SkShader::kClamp_Ti leMode, 103 SkShader* shader = SkShader::CreateBitmapShader(bitmap2, SkShader::kClamp_Ti leMode,
104 SkShader::kClamp_TileMode); 104 SkShader::kClamp_TileMode);
105 paint2.setShader(shader); 105 paint2.setShader(shader)->unref();
106 REPORTER_ASSERT(r, shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault _BitmapType); 106 REPORTER_ASSERT(r, shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault _BitmapType);
107 107
108 APPEND(record, SkRecords::DrawRect, paint2, rect); 108 APPEND(record, SkRecords::DrawRect, paint2, rect);
109 REPORTER_ASSERT(r, SkRecordWillPlaybackBitmaps(record)); 109 REPORTER_ASSERT(r, SkRecordWillPlaybackBitmaps(record));
110 } 110 }
111 111
112 #undef APPEND 112 #undef APPEND
113 113
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