Update framework to support r5967 of Skia.

bug: 6906025
Change-Id: Iefdb830ec3aa2ab3472c1c142484a7aa21788a15
This commit is contained in:
Derek Sollenberger
2012-08-14 16:44:52 -04:00
parent dbc8cee1d5
commit ca79cf69d0
20 changed files with 54 additions and 79 deletions

View File

@@ -515,22 +515,22 @@ class GLES20Canvas extends HardwareCanvas {
@Override
public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) {
return nQuickReject(mRenderer, left, top, right, bottom, type.nativeInt);
return nQuickReject(mRenderer, left, top, right, bottom);
}
private static native boolean nQuickReject(int renderer, float left, float top,
float right, float bottom, int edge);
float right, float bottom);
@Override
public boolean quickReject(Path path, EdgeType type) {
path.computeBounds(mPathBounds, true);
return nQuickReject(mRenderer, mPathBounds.left, mPathBounds.top,
mPathBounds.right, mPathBounds.bottom, type.nativeInt);
mPathBounds.right, mPathBounds.bottom);
}
@Override
public boolean quickReject(RectF rect, EdgeType type) {
return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom, type.nativeInt);
return nQuickReject(mRenderer, rect.left, rect.top, rect.right, rect.bottom);
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -160,6 +160,7 @@ LOCAL_C_INCLUDES += \
external/skia/include/effects \
external/skia/include/images \
external/skia/include/ports \
external/skia/src/core \
external/skia/src/ports \
external/skia/include/utils \
external/sqlite/dist \

View File

@@ -231,7 +231,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
}
SkAutoTDelete<SkImageDecoder> add(decoder);
SkAutoTDelete<SkBitmap> adb(bitmap, !useExistingBitmap);
SkAutoTDelete<SkBitmap> adb(!useExistingBitmap ? bitmap : NULL);
decoder->setPeeker(&peeker);
if (!isPurgeable) {

View File

@@ -278,25 +278,25 @@ public:
canvas->setDrawFilter(filter);
}
static jboolean quickReject__RectFI(JNIEnv* env, jobject, SkCanvas* canvas,
jobject rect, int edgetype) {
static jboolean quickReject__RectF(JNIEnv* env, jobject, SkCanvas* canvas,
jobject rect) {
SkRect rect_;
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
return canvas->quickReject(rect_, (SkCanvas::EdgeType)edgetype);
return canvas->quickReject(rect_);
}
static jboolean quickReject__PathI(JNIEnv* env, jobject, SkCanvas* canvas,
SkPath* path, int edgetype) {
return canvas->quickReject(*path, (SkCanvas::EdgeType)edgetype);
static jboolean quickReject__Path(JNIEnv* env, jobject, SkCanvas* canvas,
SkPath* path) {
return canvas->quickReject(*path);
}
static jboolean quickReject__FFFFI(JNIEnv* env, jobject, SkCanvas* canvas,
static jboolean quickReject__FFFF(JNIEnv* env, jobject, SkCanvas* canvas,
jfloat left, jfloat top, jfloat right,
jfloat bottom, int edgetype) {
jfloat bottom) {
SkRect r;
r.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
return canvas->quickReject(r, (SkCanvas::EdgeType)edgetype);
return canvas->quickReject(r);
}
static void drawRGB(JNIEnv* env, jobject, SkCanvas* canvas,
@@ -938,12 +938,19 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
jobject bounds) {
SkRect r;
SkIRect ir;
bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType);
bool result = canvas->getClipBounds(&r);
if (!result) {
r.setEmpty();
} else {
// ensure the clip is not larger than the canvas
SkRect canvasRect;
SkISize deviceSize = canvas->getDeviceSize();
canvasRect.iset(0, 0, deviceSize.fWidth, deviceSize.fHeight);
r.intersect(canvasRect);
}
r.round(&ir);
(void)GraphicsJNI::irect_to_jrect(ir, env, bounds);
return result;
}
@@ -992,10 +999,10 @@ static JNINativeMethod gCanvasMethods[] = {
{"native_getClipBounds","(ILandroid/graphics/Rect;)Z",
(void*) SkCanvasGlue::getClipBounds},
{"native_getCTM", "(II)V", (void*)SkCanvasGlue::getCTM},
{"native_quickReject","(ILandroid/graphics/RectF;I)Z",
(void*) SkCanvasGlue::quickReject__RectFI},
{"native_quickReject","(III)Z", (void*) SkCanvasGlue::quickReject__PathI},
{"native_quickReject","(IFFFFI)Z", (void*)SkCanvasGlue::quickReject__FFFFI},
{"native_quickReject","(ILandroid/graphics/RectF;)Z",
(void*) SkCanvasGlue::quickReject__RectF},
{"native_quickReject","(II)Z", (void*) SkCanvasGlue::quickReject__Path},
{"native_quickReject","(IFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF},
{"native_drawRGB","(IIII)V", (void*) SkCanvasGlue::drawRGB},
{"native_drawARGB","(IIIII)V", (void*) SkCanvasGlue::drawARGB},
{"native_drawColor","(II)V", (void*) SkCanvasGlue::drawColor__I},

View File

@@ -105,7 +105,7 @@ SkScalar calculateStretch(SkScalar boundsLimit, SkScalar startingPoint,
void NinePatch_Draw(SkCanvas* canvas, const SkRect& bounds,
const SkBitmap& bitmap, const android::Res_png_9patch& chunk,
const SkPaint* paint, SkRegion** outRegion) {
if (canvas && canvas->quickReject(bounds, SkCanvas::kBW_EdgeType)) {
if (canvas && canvas->quickReject(bounds)) {
return;
}

View File

@@ -177,7 +177,7 @@ static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject par
SkRegion* region = new SkRegion;
size_t size = p->readInt32();
region->unflatten(p->readInplace(size));
region->readFromMemory(p->readInplace(size));
return region;
}
@@ -190,9 +190,9 @@ static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion*
android::Parcel* p = android::parcelForJavaObject(env, parcel);
size_t size = region->flatten(NULL);
size_t size = region->writeToMemory(NULL);
p->writeInt32(size);
region->flatten(p->writeInplace(size));
region->writeToMemory(p->writeInplace(size));
return true;
}

View File

@@ -358,7 +358,7 @@ TextLayoutShaper::TextLayoutShaper() : mShaperItemGlyphArraySize(0) {
}
void TextLayoutShaper::init() {
mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, SkTypeface::kNormal);
mDefaultTypeface = SkFontHost::CreateTypeface(NULL, NULL, SkTypeface::kNormal);
}
void TextLayoutShaper::unrefTypefaces() {

View File

@@ -147,25 +147,6 @@ static SkTypeface* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath)
return SkTypeface::CreateFromFile(str.c_str());
}
#define MIN_GAMMA (0.1f)
#define MAX_GAMMA (10.0f)
static float pinGamma(float gamma) {
if (gamma < MIN_GAMMA) {
gamma = MIN_GAMMA;
} else if (gamma > MAX_GAMMA) {
gamma = MAX_GAMMA;
}
return gamma;
}
extern void skia_set_text_gamma(float, float);
static void Typeface_setGammaForText(JNIEnv* env, jobject, jfloat blackGamma,
jfloat whiteGamma) {
// Comment this out for release builds. This is only used during development
skia_set_text_gamma(pinGamma(blackGamma), pinGamma(whiteGamma));
}
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gTypefaceMethods[] = {
@@ -177,7 +158,6 @@ static JNINativeMethod gTypefaceMethods[] = {
(void*)Typeface_createFromAsset },
{ "nativeCreateFromFile", "(Ljava/lang/String;)I",
(void*)Typeface_createFromFile },
{ "setGammaForText", "(FF)V", (void*)Typeface_setGammaForText },
};
int register_android_graphics_Typeface(JNIEnv* env)

View File

@@ -258,8 +258,7 @@ static jint android_view_GLES20Canvas_saveLayerAlphaClip(JNIEnv* env, jobject cl
// ----------------------------------------------------------------------------
static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom,
SkCanvas::EdgeType edge) {
OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) {
return renderer->quickReject(left, top, right, bottom);
}
@@ -934,7 +933,7 @@ static JNINativeMethod gMethods[] = {
{ "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha },
{ "nSaveLayerAlpha", "(III)I", (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
{ "nQuickReject", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_quickReject },
{ "nQuickReject", "(IFFFF)Z", (void*) android_view_GLES20Canvas_quickReject },
{ "nClipRect", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF },
{ "nClipRect", "(IIIIII)Z", (void*) android_view_GLES20Canvas_clipRect },

View File

@@ -135,6 +135,7 @@ public:
return mScreenshot.getFormat();
}
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
// overrides from SkPixelRef
virtual void* onLockPixels(SkColorTable** ct) {

View File

@@ -706,7 +706,7 @@ public class Canvas {
* does not intersect with the canvas' clip
*/
public boolean quickReject(RectF rect, EdgeType type) {
return native_quickReject(mNativeCanvas, rect, type.nativeInt);
return native_quickReject(mNativeCanvas, rect);
}
/**
@@ -726,7 +726,7 @@ public class Canvas {
* does not intersect with the canvas' clip
*/
public boolean quickReject(Path path, EdgeType type) {
return native_quickReject(mNativeCanvas, path.ni(), type.nativeInt);
return native_quickReject(mNativeCanvas, path.ni());
}
/**
@@ -749,9 +749,9 @@ public class Canvas {
* @return true if the rect (transformed by the canvas' matrix)
* does not intersect with the canvas' clip
*/
public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) {
return native_quickReject(mNativeCanvas, left, top, right, bottom,
type.nativeInt);
public boolean quickReject(float left, float top, float right, float bottom,
EdgeType type) {
return native_quickReject(mNativeCanvas, left, top, right, bottom);
}
/**
@@ -1656,15 +1656,12 @@ public class Canvas {
Rect bounds);
private static native void native_getCTM(int canvas, int matrix);
private static native boolean native_quickReject(int nativeCanvas,
RectF rect,
int native_edgeType);
RectF rect);
private static native boolean native_quickReject(int nativeCanvas,
int path,
int native_edgeType);
int path);
private static native boolean native_quickReject(int nativeCanvas,
float left, float top,
float right, float bottom,
int native_edgeType);
float right, float bottom);
private static native void native_drawRGB(int nativeCanvas, int r, int g,
int b);
private static native void native_drawARGB(int nativeCanvas, int a, int r,

View File

@@ -225,16 +225,4 @@ public class Typeface {
private static native int nativeGetStyle(int native_instance);
private static native int nativeCreateFromAsset(AssetManager mgr, String path);
private static native int nativeCreateFromFile(String path);
/**
* Set the global gamma coefficients for black and white text. This call is
* usually a no-op in shipping products, and only exists for testing during
* development.
*
* @param blackGamma gamma coefficient for black text
* @param whiteGamma gamma coefficient for white text
*
* @hide - this is just for calibrating devices, not for normal apps
*/
public static native void setGammaForText(float blackGamma, float whiteGamma);
}

View File

@@ -42,6 +42,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
external/skia/include/core \
external/skia/include/effects \
external/skia/include/images \
external/skia/src/core \
external/skia/src/ports \
external/skia/include/utils

View File

@@ -18,7 +18,8 @@
#define ANDROID_HWUI_DISPLAY_LIST_RENDERER_H
#include <SkChunkAlloc.h>
#include <SkFlattenable.h>
#include <SkReader32.h>
#include <SkWriter32.h>
#include <SkMatrix.h>
#include <SkCamera.h>
#include <SkPaint.h>
@@ -499,7 +500,7 @@ private:
Vector<SkiaShader*> mShaders;
Vector<Layer*> mLayers;
mutable SkFlattenableReadBuffer mReader;
mutable SkReader32 mReader;
size_t mSize;

View File

@@ -16,6 +16,7 @@
#define LOG_TAG "OpenGLRenderer"
#include <SkGlyph.h>
#include <SkUtils.h>
#include <cutils/properties.h>

View File

@@ -23,6 +23,7 @@
#include <ui/Region.h>
#include <SkPaint.h>
#include <SkXfermode.h>
#include "Rect.h"

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <SkGlyph.h>
#include <utils/Log.h>
#include "Debug.h"

View File

@@ -18,6 +18,7 @@
#include <cutils/compiler.h>
#include <SkGlyph.h>
#include <SkUtils.h>
#include "Debug.h"

View File

@@ -33,6 +33,7 @@ public:
//! Return the allocation size for the pixels
size_t getSize() const { return mSize; }
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
// overrides from SkPixelRef
virtual void* onLockPixels(SkColorTable**);

View File

@@ -188,11 +188,6 @@ public final class Typeface_Delegate {
return delegate.mStyle;
}
@LayoutlibDelegate
/*package*/ static void setGammaForText(float blackGamma, float whiteGamma) {
// This is for device testing only: pass
}
// ---- Private delegate/helper methods ----
private Typeface_Delegate(String family, int style) {