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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 255133004: fix cycle_colortypes so we can test 565 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "SampleApp.h" 7 #include "SampleApp.h"
8 8
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #ifdef PIPE_FILE 71 #ifdef PIPE_FILE
72 #define FILE_PATH "/path/to/drawing.data" 72 #define FILE_PATH "/path/to/drawing.data"
73 #endif 73 #endif
74 74
75 #define PIPE_NETx 75 #define PIPE_NETx
76 #ifdef PIPE_NET 76 #ifdef PIPE_NET
77 #include "SkSockets.h" 77 #include "SkSockets.h"
78 SkTCPServer gServer; 78 SkTCPServer gServer;
79 #endif 79 #endif
80 80
81 #define USE_ARROWS_FOR_ZOOM true 81 #define USE_ARROWS_FOR_ZOOM false
82 82
83 #if SK_ANGLE 83 #if SK_ANGLE
84 //#define DEFAULT_TO_ANGLE 1 84 //#define DEFAULT_TO_ANGLE 1
85 #else 85 #else
86 #define DEFAULT_TO_GPU 0 // if 1 default rendering is on GPU 86 #define DEFAULT_TO_GPU 0 // if 1 default rendering is on GPU
87 #endif 87 #endif
88 88
89 #define ANIMATING_EVENTTYPE "nextSample" 89 #define ANIMATING_EVENTTYPE "nextSample"
90 #define ANIMATING_DELAY 250 90 #define ANIMATING_DELAY 250
91 91
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 #if SK_SUPPORT_GPU 290 #if SK_SUPPORT_GPU
291 if (fCurContext) { 291 if (fCurContext) {
292 // in case we have queued drawing calls 292 // in case we have queued drawing calls
293 fCurContext->flush(); 293 fCurContext->flush();
294 294
295 if (!IsGpuDeviceType(dType)) { 295 if (!IsGpuDeviceType(dType)) {
296 // need to send the raster bits to the (gpu) window 296 // need to send the raster bits to the (gpu) window
297 fCurContext->setRenderTarget(fCurRenderTarget); 297 fCurContext->setRenderTarget(fCurRenderTarget);
298 const SkBitmap& bm = win->getBitmap(); 298 const SkBitmap& bm = win->getBitmap();
299 fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(), 299 fCurRenderTarget->writePixels(0, 0, bm.width(), bm.height(),
300 kSkia8888_GrPixelConfig, 300 SkImageInfo2GrPixelConfig(bm.colorT ype(),
301 bm.alphaT ype()),
301 bm.getPixels(), 302 bm.getPixels(),
302 bm.rowBytes()); 303 bm.rowBytes());
303 } 304 }
304 } 305 }
305 #endif 306 #endif
306 307
307 win->present(); 308 win->present();
308 } 309 }
309 310
310 virtual void windowSizeChanged(SampleWindow* win) { 311 virtual void windowSizeChanged(SampleWindow* win) {
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 } 1540 }
1540 } 1541 }
1541 1542
1542 void SampleWindow::afterChild(SkView* child, SkCanvas* canvas) { 1543 void SampleWindow::afterChild(SkView* child, SkCanvas* canvas) {
1543 canvas->setDrawFilter(NULL); 1544 canvas->setDrawFilter(NULL);
1544 } 1545 }
1545 1546
1546 static SkColorType gColorTypeCycle[] = { 1547 static SkColorType gColorTypeCycle[] = {
1547 kUnknown_SkColorType, // none -> none 1548 kUnknown_SkColorType, // none -> none
1548 kUnknown_SkColorType, // a8 -> none 1549 kUnknown_SkColorType, // a8 -> none
1549 kARGB_4444_SkColorType, // 565 -> 4444 1550 kN32_SkColorType, // 565 -> 8888
1550 kN32_SkColorType, // 4444 -> 8888 1551 kN32_SkColorType, // 4444 -> 8888
1551 kRGB_565_SkColorType, // 8888 -> 565 1552 kRGB_565_SkColorType, // 8888 -> 565
1552 kRGB_565_SkColorType, // 8888 -> 565 1553 kRGB_565_SkColorType, // 8888 -> 565
1553 kUnknown_SkColorType, // index8 -> none 1554 kUnknown_SkColorType, // index8 -> none
1554 }; 1555 };
1555 1556
1556 static SkColorType cycle_colortypes(SkColorType c) { 1557 static SkColorType cycle_colortypes(SkColorType c) {
1557 return gColorTypeCycle[c]; 1558 return gColorTypeCycle[c];
1558 } 1559 }
1559 1560
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 SkGraphics::Init(); 2558 SkGraphics::Init();
2558 SkEvent::Init(); 2559 SkEvent::Init();
2559 } 2560 }
2560 2561
2561 // FIXME: this should be in a header 2562 // FIXME: this should be in a header
2562 void application_term(); 2563 void application_term();
2563 void application_term() { 2564 void application_term() {
2564 SkEvent::Term(); 2565 SkEvent::Term();
2565 SkGraphics::Term(); 2566 SkGraphics::Term();
2566 } 2567 }
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