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

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

Issue 302053002: Revert of setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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 | « src/utils/SkPictureUtils.cpp ('k') | tests/BitmapCopyTest.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 = NULL;
21 evt.user.data2 = NULL; 21 evt.user.data2 = NULL;
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 SkBitmap::Config config;
27 SkAlphaType at;
28 27
29 switch (src->format->BytesPerPixel) { 28 switch (src->format->BytesPerPixel) {
30 case 2: 29 case 2:
31 ct = kRGB_565_SkColorType; 30 config = SkBitmap::kRGB_565_Config;
32 at = kOpaque_SkAlphaType;
33 break; 31 break;
34 case 4: 32 case 4:
35 ct = kN32_SkColorType; 33 config = SkBitmap::kARGB_8888_Config;
36 at = kPremul_SkAlphaType;
37 break; 34 break;
38 default: 35 default:
39 return false; 36 return false;
40 } 37 }
41 38
42 return dst->installPixels(SkImageInfo::Make(src->w, src->h, ct, at), src->pi xels, src->pitch); 39 dst->setConfig(config, src->w, src->h, src->pitch);
40 dst->setPixels(src->pixels);
41 return true;
43 } 42 }
44 43
45 SkOSWindow::SkOSWindow(void* screen) { 44 SkOSWindow::SkOSWindow(void* screen) {
46 fScreen = reinterpret_cast<SDL_Surface*>(screen); 45 fScreen = reinterpret_cast<SDL_Surface*>(screen);
47 this->resize(fScreen->w, fScreen->h); 46 this->resize(fScreen->w, fScreen->h);
48 47
49 uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT; 48 uint32_t rmask = SK_R32_MASK << SK_R32_SHIFT;
50 uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT; 49 uint32_t gmask = SK_G32_MASK << SK_G32_SHIFT;
51 uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT; 50 uint32_t bmask = SK_B32_MASK << SK_B32_SHIFT;
52 uint32_t amask = SK_A32_MASK << SK_A32_SHIFT; 51 uint32_t amask = SK_A32_MASK << SK_A32_SHIFT;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return 0; 217 return 0;
219 } 218 }
220 219
221 void SkEvent::SignalQueueTimer(SkMSec delay) 220 void SkEvent::SignalQueueTimer(SkMSec delay)
222 { 221 {
223 SDL_SetTimer(0, NULL); 222 SDL_SetTimer(0, NULL);
224 if (delay) { 223 if (delay) {
225 SDL_SetTimer(delay, timer_callback); 224 SDL_SetTimer(delay, timer_callback);
226 } 225 }
227 } 226 }
OLDNEW
« no previous file with comments | « src/utils/SkPictureUtils.cpp ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698