This commit is contained in:
Vadim Lopatin 2015-11-30 20:52:38 +03:00
parent 2a0d73476d
commit 31bf7b8f3b
1 changed files with 15 additions and 6 deletions

View File

@ -101,7 +101,7 @@ class IWindowListenerLogger : IWindowListener {
} }
override void onMouseMove(int x, int y, int deltaX, int deltaY, override void onMouseMove(int x, int y, int deltaX, int deltaY,
MouseState mouseState) { MouseState mouseState) {
Log.d("onMouseMove"); Log.d("onMouseMove ", x, ", ", y);
} }
override void onMouseRelease(int x, int y, MouseButton mb, MouseState mouseState) { override void onMouseRelease(int x, int y, MouseButton mb, MouseState mouseState) {
Log.d("onMouseRelease"); Log.d("onMouseRelease");
@ -113,14 +113,18 @@ class IWindowListenerLogger : IWindowListener {
//Log.d("recomputeDirtyAreas"); //Log.d("recomputeDirtyAreas");
} }
override void onResized(int width, int height) { override void onResized(int width, int height) {
Log.d("onResized"); Log.d("onResized ", width, ", ", height);
_width = width;
_height = height;
} }
override void onAnimate(double dt, double time) { override void onAnimate(double dt, double time) {
//Log.d("onAnimate"); //Log.d("onAnimate");
} }
override Rect getDirtyRectangle() { override Rect getDirtyRectangle() {
return Rect(0, 0, 100, 100); return Rect(0, 0, _width, _height);
} }
int _width = 100;
int _height = 100;
} }
struct MouseState { struct MouseState {
@ -398,6 +402,7 @@ private:
int width = cast(int)(boundsRect.size.width); // truncating down the dimensions of bounds int width = cast(int)(boundsRect.size.width); // truncating down the dimensions of bounds
int height = cast(int)(boundsRect.size.height); int height = cast(int)(boundsRect.size.height);
updateSizeIfNeeded(width, height); updateSizeIfNeeded(width, height);
_drawBuf.resize(width, height);
} }
// The first drawRect callback occurs before the timer triggers. // The first drawRect callback occurs before the timer triggers.
@ -423,11 +428,15 @@ private:
_imageData = NSData.dataWithBytesNoCopy(cast(ubyte*)_drawBuf.scanLine(0), sizeNeeded, false); _imageData = NSData.dataWithBytesNoCopy(cast(ubyte*)_drawBuf.scanLine(0), sizeNeeded, false);
CIImage image = CIImage.imageWithBitmapData(_imageData, CIImage image = CIImage.imageWithBitmapData(_imageData,
byteStride(_width), byteStride(_drawBuf.width),
CGSize(_width, _height), CGSize(_drawBuf.width, _drawBuf.height),
kCIFormatARGB8, kCIFormatARGB8,
_cgColorSpaceRef); _cgColorSpaceRef);
// NSRect rc;
// rc.origin.x = 0;
// rc.origin.y = 0;
// rc.size.width = _drawBuf.width;
// rc.size.height = _drawBuf.height;
ciContext.drawImage(image, rect, rect); ciContext.drawImage(image, rect, rect);
} }