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

Side by Side Diff: ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java

Issue 25015003: gfx: Create a separate gfx component out of ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 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 | « tools/set_default_handler/set_default_handler.gyp ('k') | ui/android/ui_jni_registrar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 package org.chromium.ui.gfx; 5 package org.chromium.ui.gfx;
6 6
7 import android.content.res.Resources; 7 import android.content.res.Resources;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.graphics.BitmapFactory; 9 import android.graphics.BitmapFactory;
10 import org.chromium.base.CalledByNative; 10 import org.chromium.base.CalledByNative;
11 import org.chromium.base.JNINamespace; 11 import org.chromium.base.JNINamespace;
12 12
13 @JNINamespace("ui") 13 @JNINamespace("gfx")
14 public class BitmapHelper { 14 public class BitmapHelper {
15 @CalledByNative 15 @CalledByNative
16 public static Bitmap createBitmap(int width, int height) { 16 public static Bitmap createBitmap(int width, int height) {
17 return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 17 return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
18 } 18 }
19 19
20 /** 20 /**
21 * Decode and sample down a bitmap resource to the requested width and heigh t. 21 * Decode and sample down a bitmap resource to the requested width and heigh t.
22 * 22 *
23 * @param name The resource name of the bitmap to decode. 23 * @param name The resource name of the bitmap to decode.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Choose the smallest ratio as inSampleSize value, this will guaran tee 61 // Choose the smallest ratio as inSampleSize value, this will guaran tee
62 // a final image with both dimensions larger than or equal to the 62 // a final image with both dimensions larger than or equal to the
63 // requested height and width. 63 // requested height and width.
64 inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; 64 inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
65 } 65 }
66 66
67 return inSampleSize; 67 return inSampleSize;
68 } 68 }
69 } 69 }
OLDNEW
« no previous file with comments | « tools/set_default_handler/set_default_handler.gyp ('k') | ui/android/ui_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698