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

Side by Side Diff: src/views/unix/SkOSWindow_Unix.cpp

Issue 16337012: Smallest possible desktop application that uses Skia to render stuff. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Update to Mike's fix. Code review. Created 7 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
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 <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/XKBlib.h> 10 #include <X11/XKBlib.h>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SkMSec ms = gTimerDelay; 175 SkMSec ms = gTimerDelay;
176 if (ms > 0) { 176 if (ms > 0) {
177 int x11_fd = ConnectionNumber(dsp); 177 int x11_fd = ConnectionNumber(dsp);
178 fd_set input_fds; 178 fd_set input_fds;
179 FD_ZERO(&input_fds); 179 FD_ZERO(&input_fds);
180 FD_SET(x11_fd, &input_fds); 180 FD_SET(x11_fd, &input_fds);
181 181
182 timeval tv; 182 timeval tv;
183 tv.tv_sec = ms / 1000; // seconds 183 tv.tv_sec = ms / 1000; // seconds
184 tv.tv_usec = (ms % 1000) * 1000; // microseconds 184 tv.tv_usec = (ms % 1000) * 1000; // microseconds
185 185
186 (void)select(x11_fd + 1, &input_fds, NULL, NULL, &tv); 186 (void)select(x11_fd + 1, &input_fds, NULL, NULL, &tv);
187 } 187 }
188 188
189 if (XPending(dsp)) { 189 if (XPending(dsp)) {
190 XNextEvent(dsp, evt); 190 XNextEvent(dsp, evt);
191 } 191 }
192 } 192 }
193 193
194 SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() { 194 SkOSWindow::NextXEventResult SkOSWindow::nextXEvent() {
195 XEvent evt; 195 XEvent evt;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 image.depth = 24; 367 image.depth = 24;
368 image.bytes_per_line = bitmap.rowBytes() - bitmap.width() * 4; 368 image.bytes_per_line = bitmap.rowBytes() - bitmap.width() * 4;
369 image.bits_per_pixel = bitsPerPixel; 369 image.bits_per_pixel = bitsPerPixel;
370 return XInitImage(&image); 370 return XInitImage(&image);
371 } 371 }
372 372
373 void SkOSWindow::doPaint() { 373 void SkOSWindow::doPaint() {
374 if (NULL == fUnixWindow.fDisplay) { 374 if (NULL == fUnixWindow.fDisplay) {
375 return; 375 return;
376 } 376 }
377 // If we are drawing with GL, we don't need XPutImage.
378 if (NULL != fUnixWindow.fGLContext) {
379 return;
380 }
sglez 2013/06/17 18:04:35 This is a fix to Mike's recent changes; it fixes a
377 // Draw the bitmap to the screen. 381 // Draw the bitmap to the screen.
378 const SkBitmap& bitmap = getBitmap(); 382 const SkBitmap& bitmap = getBitmap();
379 int width = bitmap.width(); 383 int width = bitmap.width();
380 int height = bitmap.height(); 384 int height = bitmap.height();
381 385
382 XImage image; 386 XImage image;
383 if (!convertBitmapToXImage(image, bitmap)) { 387 if (!convertBitmapToXImage(image, bitmap)) {
384 return; 388 return;
385 } 389 }
386 390
(...skipping 11 matching lines...) Expand all
398 void SkEvent::SignalNonEmptyQueue() { 402 void SkEvent::SignalNonEmptyQueue() {
399 // nothing to do, since we spin on our event-queue, polling for XPending 403 // nothing to do, since we spin on our event-queue, polling for XPending
400 } 404 }
401 405
402 void SkEvent::SignalQueueTimer(SkMSec delay) { 406 void SkEvent::SignalQueueTimer(SkMSec delay) {
403 // just need to record the delay time. We handle waking up for it in 407 // just need to record the delay time. We handle waking up for it in
404 // MyXNextEventWithDelay() 408 // MyXNextEventWithDelay()
405 gTimerDelay = delay; 409 gTimerDelay = delay;
406 } 410 }
407 411
OLDNEW
« experimental/SkiaExamples/BaseExample.cpp ('K') | « gyp/SkiaExamples.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698