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

Side by Side Diff: ui/gfx/android/java_bitmap.cc

Issue 11886074: Use correct favicon scale factor on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split DeviceTelephonyInfo from DeviceDisplayInfo; added SCALE_FACTOR_150P and 300P. Created 7 years, 11 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/android/java_bitmap.h" 5 #include "ui/gfx/android/java_bitmap.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "jni/BitmapHelper_jni.h" 10 #include "jni/BitmapHelper_jni.h"
(...skipping 17 matching lines...) Expand all
28 size_ = gfx::Size(info.width, info.height); 28 size_ = gfx::Size(info.width, info.height);
29 format_ = info.format; 29 format_ = info.format;
30 stride_ = info.stride; 30 stride_ = info.stride;
31 } 31 }
32 32
33 JavaBitmap::~JavaBitmap() { 33 JavaBitmap::~JavaBitmap() {
34 int err = AndroidBitmap_unlockPixels(AttachCurrentThread(), bitmap_); 34 int err = AndroidBitmap_unlockPixels(AttachCurrentThread(), bitmap_);
35 DCHECK(!err); 35 DCHECK(!err);
36 } 36 }
37 37
38 void RegisterBitmapAndroid(JNIEnv* env) { 38 // static
39 ui::RegisterNativesImpl(env); 39 bool JavaBitmap::RegisterJavaBitmap(JNIEnv* env) {
40 return ui::RegisterNativesImpl(env);
40 } 41 }
41 42
42 ScopedJavaLocalRef<jobject> CreateJavaBitmap(const gfx::Size& size) { 43 ScopedJavaLocalRef<jobject> CreateJavaBitmap(const gfx::Size& size) {
43 return ui::Java_BitmapHelper_createBitmap(AttachCurrentThread(), 44 return ui::Java_BitmapHelper_createBitmap(AttachCurrentThread(),
44 size.width(), size.height()); 45 size.width(), size.height());
45 } 46 }
46 47
47 ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap) { 48 ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap) {
48 DCHECK(skbitmap); 49 DCHECK(skbitmap);
49 DCHECK_EQ(skbitmap->bytesPerPixel(), 4); 50 DCHECK_EQ(skbitmap->bytesPerPixel(), 4);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 memcpy(dst_pixels, src_pixels, skbitmap.getSize()); 85 memcpy(dst_pixels, src_pixels, skbitmap.getSize());
85 86
86 return skbitmap; 87 return skbitmap;
87 } 88 }
88 89
89 SkBitmap CreateSkBitmapFromResource(const char* name) { 90 SkBitmap CreateSkBitmapFromResource(const char* name) {
90 return ConvertToSkBitmap(CreateJavaBitmapFromResource(name)); 91 return ConvertToSkBitmap(CreateJavaBitmapFromResource(name));
91 } 92 }
92 93
93 } // namespace gfx 94 } // namespace gfx
OLDNEW
« ui/base/layout.cc ('K') | « ui/gfx/android/java_bitmap.h ('k') | ui/gfx/screen_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698