OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/browser/in_process_view_renderer.h" | 5 #include "android_webview/browser/in_process_view_renderer.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "android_webview/browser/aw_gl_surface.h" | 9 #include "android_webview/browser/aw_gl_surface.h" |
10 #include "android_webview/browser/scoped_app_gl_state_restore.h" | 10 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 SkBitmap bitmap; | 490 SkBitmap bitmap; |
491 bitmap.setConfig(config, | 491 bitmap.setConfig(config, |
492 pixels->width, | 492 pixels->width, |
493 pixels->height, | 493 pixels->height, |
494 pixels->row_bytes); | 494 pixels->row_bytes); |
495 bitmap.setPixels(pixels->pixels); | 495 bitmap.setPixels(pixels->pixels); |
496 SkDevice device(bitmap); | 496 SkDevice device(bitmap); |
497 SkCanvas canvas(&device); | 497 SkCanvas canvas(&device); |
498 canvas.setMatrix(matrix); | 498 canvas.setMatrix(matrix); |
499 | 499 |
500 if (pixels->clip_region) { | 500 if (pixels->clip_rect_count) { |
501 SkRegion clip_region; | |
502 size_t bytes_read = clip_region.readFromMemory(pixels->clip_region); | |
503 DCHECK_EQ(pixels->clip_region_size, bytes_read); | |
504 canvas.setClipRegion(clip_region); | |
505 } else if (pixels->clip_rect_count) { | |
506 SkRegion clip; | 501 SkRegion clip; |
507 for (int i = 0; i < pixels->clip_rect_count; ++i) { | 502 for (int i = 0; i < pixels->clip_rect_count; ++i) { |
508 clip.op(SkIRect::MakeXYWH(pixels->clip_rects[i + 0], | 503 clip.op(SkIRect::MakeXYWH(pixels->clip_rects[i + 0], |
509 pixels->clip_rects[i + 1], | 504 pixels->clip_rects[i + 1], |
510 pixels->clip_rects[i + 2], | 505 pixels->clip_rects[i + 2], |
511 pixels->clip_rects[i + 3]), | 506 pixels->clip_rects[i + 3]), |
512 SkRegion::kUnion_Op); | 507 SkRegion::kUnion_Op); |
513 } | 508 } |
514 canvas.setClipRegion(clip); | 509 canvas.setClipRegion(clip); |
515 } | 510 } |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 base::StringAppendF(&str, | 820 base::StringAppendF(&str, |
826 "surface width height: [%d %d] ", | 821 "surface width height: [%d %d] ", |
827 draw_info->width, | 822 draw_info->width, |
828 draw_info->height); | 823 draw_info->height); |
829 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 824 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
830 } | 825 } |
831 return str; | 826 return str; |
832 } | 827 } |
833 | 828 |
834 } // namespace android_webview | 829 } // namespace android_webview |
OLD | NEW |