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

Unified Diff: chrome/browser/renderer_host/backing_store_posix.cc

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/backing_store_posix.cc
diff --git a/chrome/browser/renderer_host/backing_store_posix.cc b/chrome/browser/renderer_host/backing_store_posix.cc
index f925ef93c7868cc96ea035cfd4d9f90539a68648..1d195fb7fb4ad011345539cee30d9e96563f0e5e 100644
--- a/chrome/browser/renderer_host/backing_store_posix.cc
+++ b/chrome/browser/renderer_host/backing_store_posix.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/renderer_host/backing_store.h"
#include "base/logging.h"
+#include "chrome/common/transport_dib.h"
#include "skia/ext/platform_canvas.h"
#include "skia/include/SkBitmap.h"
#include "skia/include/SkCanvas.h"
@@ -19,20 +20,20 @@ BackingStore::~BackingStore() {
}
bool BackingStore::PaintRect(base::ProcessHandle process,
- BitmapWireData bitmap,
+ TransportDIB* bitmap,
const gfx::Rect& bitmap_rect) {
- if (bitmap.width() != bitmap_rect.width() ||
- bitmap.height() != bitmap_rect.height() ||
- bitmap.config() != SkBitmap::kARGB_8888_Config) {
- return false;
- }
+ SkBitmap skbitmap;
+ skbitmap.setConfig(SkBitmap::kARGB_8888_Config, bitmap_rect.width(),
+ bitmap_rect.height(), 4 * bitmap_rect.width());
+
+ skbitmap.setPixels(bitmap->memory());
- canvas_.drawBitmap(bitmap, bitmap_rect.x(), bitmap_rect.y());
+ canvas_.drawBitmap(skbitmap, bitmap_rect.x(), bitmap_rect.y());
return true;
}
void BackingStore::ScrollRect(base::ProcessHandle process,
- BitmapWireData bitmap,
+ TransportDIB* bitmap,
const gfx::Rect& bitmap_rect,
int dx, int dy,
const gfx::Rect& clip_rect,
@@ -59,12 +60,6 @@ void BackingStore::ScrollRect(base::ProcessHandle process,
DCHECK(clip_rect.bottom() <= canvas_.getDevice()->height());
DCHECK(clip_rect.right() <= canvas_.getDevice()->width());
- if (bitmap.width() != bitmap_rect.width() ||
- bitmap.height() != bitmap_rect.height() ||
- bitmap.config() != SkBitmap::kARGB_8888_Config) {
- return;
- }
-
const SkBitmap &backing_bitmap = canvas_.getDevice()->accessBitmap(true);
const int stride = backing_bitmap.rowBytes();
uint8_t* x = static_cast<uint8_t*>(backing_bitmap.getPixels());
@@ -123,6 +118,6 @@ void BackingStore::ScrollRect(base::ProcessHandle process,
}
// Now paint the new bitmap data.
- canvas_.drawBitmap(bitmap, bitmap_rect.x(), bitmap_rect.y());
+ PaintRect(process, bitmap, bitmap_rect);
return;
}

Powered by Google App Engine
This is Rietveld 408576698