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

Side by Side Diff: src/views/sdl/SkOSWindow_SDL.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/views/animated/SkWidgetViews.cpp ('k') | src/views/unix/SkOSWindow_Unix.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 #include "SkOSWindow_SDL.h" 8 #include "SkOSWindow_SDL.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkGLCanvas.h" 11 #include "SkGLCanvas.h"
12 #include "SkOSMenu.h" 12 #include "SkOSMenu.h"
13 #include "SkTime.h" 13 #include "SkTime.h"
14 14
15 static void post_SkEvent_event() { 15 static void post_SkEvent_event() {
16 SDL_Event evt; 16 SDL_Event evt;
17 evt.type = SDL_USEREVENT; 17 evt.type = SDL_USEREVENT;
18 evt.user.type = SDL_USEREVENT; 18 evt.user.type = SDL_USEREVENT;
19 evt.user.code = 0; 19 evt.user.code = 0;
20 evt.user.data1 = NULL; 20 evt.user.data1 = nullptr;
21 evt.user.data2 = NULL; 21 evt.user.data2 = nullptr;
22 SDL_PushEvent(&evt); 22 SDL_PushEvent(&evt);
23 } 23 }
24 24
25 static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) { 25 static bool skia_setBitmapFromSurface(SkBitmap* dst, SDL_Surface* src) {
26 SkColorType ct; 26 SkColorType ct;
27 SkAlphaType at; 27 SkAlphaType at;
28 28
29 switch (src->format->BytesPerPixel) { 29 switch (src->format->BytesPerPixel) {
30 case 2: 30 case 2:
31 ct = kRGB_565_SkColorType; 31 ct = kRGB_565_SkColorType;
(...skipping 13 matching lines...) Expand all
45 SkOSWindow::SkOSWindow(void* screen) { 45 SkOSWindow::SkOSWindow(void* screen) {
46 fScreen = reinterpret_cast<SDL_Surface*>(screen); 46 fScreen = reinterpret_cast<SDL_Surface*>(screen);
47 this->resize(fScreen->w, fScreen->h); 47 this->resize(fScreen->w, fScreen->h);
48 48
49 uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT; 49 uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT;
50 uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT; 50 uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT;
51 uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT; 51 uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT;
52 uint32_t amask = SK_A32_MASK << SK_A32_SHIFT; 52 uint32_t amask = SK_A32_MASK << SK_A32_SHIFT;
53 53
54 if (fScreen->flags & SDL_OPENGL) { 54 if (fScreen->flags & SDL_OPENGL) {
55 fSurface = NULL; 55 fSurface = nullptr;
56 fGLCanvas = new SkGLCanvas; 56 fGLCanvas = new SkGLCanvas;
57 fGLCanvas->setViewport(fScreen->w, fScreen->h); 57 fGLCanvas->setViewport(fScreen->w, fScreen->h);
58 } else { 58 } else {
59 fGLCanvas = NULL; 59 fGLCanvas = nullptr;
60 fSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, fScreen->w, fScreen->h, 60 fSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, fScreen->w, fScreen->h,
61 32, rmask, gmask, bmask, amask); 61 32, rmask, gmask, bmask, amask);
62 } 62 }
63 } 63 }
64 64
65 SkOSWindow::~SkOSWindow() { 65 SkOSWindow::~SkOSWindow() {
66 delete fGLCanvas; 66 delete fGLCanvas;
67 if (fSurface) { 67 if (fSurface) {
68 SDL_FreeSurface(fSurface); 68 SDL_FreeSurface(fSurface);
69 } 69 }
(...skipping 25 matching lines...) Expand all
95 95
96 if (skia_setBitmapFromSurface(&bitmap, fSurface)) { 96 if (skia_setBitmapFromSurface(&bitmap, fSurface)) {
97 SkCanvas canvas(bitmap); 97 SkCanvas canvas(bitmap);
98 this->draw(&canvas); 98 this->draw(&canvas);
99 } 99 }
100 100
101 if ( SDL_MUSTLOCK(fSurface) ) { 101 if ( SDL_MUSTLOCK(fSurface) ) {
102 SDL_UnlockSurface(fSurface); 102 SDL_UnlockSurface(fSurface);
103 } 103 }
104 104
105 int result = SDL_BlitSurface(fSurface, NULL, fScreen, NULL); 105 int result = SDL_BlitSurface(fSurface, nullptr, fScreen, nullptr);
106 if (result) { 106 if (result) {
107 SkDebugf("------- SDL_BlitSurface returned %d\n", result); 107 SkDebugf("------- SDL_BlitSurface returned %d\n", result);
108 } 108 }
109 SDL_UpdateRect(fScreen, 0, 0, fScreen->w, fScreen->h); 109 SDL_UpdateRect(fScreen, 0, 0, fScreen->w, fScreen->h);
110 } 110 }
111 } 111 }
112 112
113 static SkKey find_skkey(SDLKey src) { 113 static SkKey find_skkey(SDLKey src) {
114 // this array must match the enum order in SkKey.h 114 // this array must match the enum order in SkKey.h
115 static const SDLKey gKeys[] = { 115 static const SDLKey gKeys[] = {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 194
195 void SkOSWindow::onHandleInval(const SkIRect& r) { 195 void SkOSWindow::onHandleInval(const SkIRect& r) {
196 SDL_Event evt; 196 SDL_Event evt;
197 evt.type = SDL_VIDEOEXPOSE; 197 evt.type = SDL_VIDEOEXPOSE;
198 evt.expose.type = SDL_VIDEOEXPOSE; 198 evt.expose.type = SDL_VIDEOEXPOSE;
199 SDL_PushEvent(&evt); 199 SDL_PushEvent(&evt);
200 } 200 }
201 201
202 void SkOSWindow::onSetTitle(const char title[]) { 202 void SkOSWindow::onSetTitle(const char title[]) {
203 SDL_WM_SetCaption(title, NULL); 203 SDL_WM_SetCaption(title, nullptr);
204 } 204 }
205 205
206 void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) {} 206 void SkOSWindow::onAddMenu(const SkOSMenu* sk_menu) {}
207 207
208 //////////////////////////////////////////////////////////////////////////////// /////// 208 //////////////////////////////////////////////////////////////////////////////// ///////
209 209
210 void SkEvent::SignalNonEmptyQueue() { 210 void SkEvent::SignalNonEmptyQueue() {
211 SkDebugf("-------- signal nonempty\n"); 211 SkDebugf("-------- signal nonempty\n");
212 post_SkEvent_event(); 212 post_SkEvent_event();
213 } 213 }
214 214
215 static Uint32 timer_callback(Uint32 interval) { 215 static Uint32 timer_callback(Uint32 interval) {
216 // SkDebugf("-------- timercallback %d\n", interval); 216 // SkDebugf("-------- timercallback %d\n", interval);
217 SkEvent::ServiceQueueTimer(); 217 SkEvent::ServiceQueueTimer();
218 return 0; 218 return 0;
219 } 219 }
220 220
221 void SkEvent::SignalQueueTimer(SkMSec delay) 221 void SkEvent::SignalQueueTimer(SkMSec delay)
222 { 222 {
223 SDL_SetTimer(0, NULL); 223 SDL_SetTimer(0, nullptr);
224 if (delay) { 224 if (delay) {
225 SDL_SetTimer(delay, timer_callback); 225 SDL_SetTimer(delay, timer_callback);
226 } 226 }
227 } 227 }
OLDNEW
« no previous file with comments | « src/views/animated/SkWidgetViews.cpp ('k') | src/views/unix/SkOSWindow_Unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698