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

Side by Side Diff: gm/optimizations.cpp

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « gm/offsetimagefilter.cpp ('k') | gm/pathopsinverse.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 #include "SkDebugCanvas.h" 9 #include "SkDebugCanvas.h"
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // TODO: we could also render the pre and post pictures to bitmaps 388 // TODO: we could also render the pre and post pictures to bitmaps
389 // and manually compare them in this method 389 // and manually compare them in this method
390 } 390 }
391 } 391 }
392 392
393 private: 393 private:
394 void makeCheckerboard() { 394 void makeCheckerboard() {
395 static const unsigned int kCheckerboardWidth = 16; 395 static const unsigned int kCheckerboardWidth = 16;
396 static const unsigned int kCheckerboardHeight = 16; 396 static const unsigned int kCheckerboardHeight = 16;
397 397
398 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 398 fCheckerboard.allocN32Pixels(kCheckerboardWidth, kCheckerboardHeight);
399 kCheckerboardWidth, kCheckerboardHeight);
400 fCheckerboard.allocPixels();
401 SkAutoLockPixels lock(fCheckerboard);
402 for (unsigned int y = 0; y < kCheckerboardHeight; y += 2) { 399 for (unsigned int y = 0; y < kCheckerboardHeight; y += 2) {
403 SkPMColor* scanline = fCheckerboard.getAddr32(0, y); 400 SkPMColor* scanline = fCheckerboard.getAddr32(0, y);
404 for (unsigned int x = 0; x < kCheckerboardWidth; x += 2) { 401 for (unsigned int x = 0; x < kCheckerboardWidth; x += 2) {
405 *scanline++ = 0xFFFFFFFF; 402 *scanline++ = 0xFFFFFFFF;
406 *scanline++ = 0xFF000000; 403 *scanline++ = 0xFF000000;
407 } 404 }
408 scanline = fCheckerboard.getAddr32(0, y + 1); 405 scanline = fCheckerboard.getAddr32(0, y + 1);
409 for (unsigned int x = 0; x < kCheckerboardWidth; x += 2) { 406 for (unsigned int x = 0; x < kCheckerboardWidth; x += 2) {
410 *scanline++ = 0xFF000000; 407 *scanline++ = 0xFF000000;
411 *scanline++ = 0xFFFFFFFF; 408 *scanline++ = 0xFFFFFFFF;
412 } 409 }
413 } 410 }
414 } 411 }
415 412
416 SkBitmap fCheckerboard; 413 SkBitmap fCheckerboard;
417 414
418 typedef skiagm::GM INHERITED; 415 typedef skiagm::GM INHERITED;
419 }; 416 };
420 417
421 ////////////////////////////////////////////////////////////////////////////// 418 //////////////////////////////////////////////////////////////////////////////
422 419
423 DEF_GM( return new OptimizationsGM; ) 420 DEF_GM( return new OptimizationsGM; )
OLDNEW
« no previous file with comments | « gm/offsetimagefilter.cpp ('k') | gm/pathopsinverse.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698